
obj/user/stresssched.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 b6 00 00 00       	call   8000e7 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:

volatile int counter;

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	56                   	push   %esi
  80003b:	53                   	push   %ebx
	int i, j;
	int seen;
	envid_t parent = sys_getenvid();
  80003c:	e8 d4 0b 00 00       	call   800c15 <sys_getenvid>
  800041:	89 c6                	mov    %eax,%esi

	// Fork several environments
	for (i = 0; i < 20; i++)
  800043:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (fork() == 0)
  800048:	e8 45 0f 00 00       	call   800f92 <fork>
  80004d:	85 c0                	test   %eax,%eax
  80004f:	74 0f                	je     800060 <umain+0x2d>
	for (i = 0; i < 20; i++)
  800051:	83 c3 01             	add    $0x1,%ebx
  800054:	83 fb 14             	cmp    $0x14,%ebx
  800057:	75 ef                	jne    800048 <umain+0x15>
			break;
	if (i == 20) {
		sys_yield();
  800059:	e8 da 0b 00 00       	call   800c38 <sys_yield>
		return;
  80005e:	eb 69                	jmp    8000c9 <umain+0x96>
	}

	// Wait for the parent to finish forking
	while (envs[ENVX(parent)].env_status != ENV_FREE)
  800060:	89 f0                	mov    %esi,%eax
  800062:	25 ff 03 00 00       	and    $0x3ff,%eax
  800067:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80006a:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80006f:	eb 02                	jmp    800073 <umain+0x40>
		asm volatile("pause");
  800071:	f3 90                	pause  
	while (envs[ENVX(parent)].env_status != ENV_FREE)
  800073:	8b 50 54             	mov    0x54(%eax),%edx
  800076:	85 d2                	test   %edx,%edx
  800078:	75 f7                	jne    800071 <umain+0x3e>
  80007a:	bb 0a 00 00 00       	mov    $0xa,%ebx

	// Check that one environment doesn't run on two CPUs at once
	for (i = 0; i < 10; i++) {
		sys_yield();
  80007f:	e8 b4 0b 00 00       	call   800c38 <sys_yield>
  800084:	ba 10 27 00 00       	mov    $0x2710,%edx
		for (j = 0; j < 10000; j++)
			counter++;
  800089:	a1 04 40 80 00       	mov    0x804004,%eax
  80008e:	83 c0 01             	add    $0x1,%eax
  800091:	a3 04 40 80 00       	mov    %eax,0x804004
		for (j = 0; j < 10000; j++)
  800096:	83 ea 01             	sub    $0x1,%edx
  800099:	75 ee                	jne    800089 <umain+0x56>
	for (i = 0; i < 10; i++) {
  80009b:	83 eb 01             	sub    $0x1,%ebx
  80009e:	75 df                	jne    80007f <umain+0x4c>
	}

	if (counter != 10*10000)
  8000a0:	a1 04 40 80 00       	mov    0x804004,%eax
  8000a5:	3d a0 86 01 00       	cmp    $0x186a0,%eax
  8000aa:	75 24                	jne    8000d0 <umain+0x9d>
		panic("ran on two CPUs at once (counter is %d)", counter);

	// Check that we see environments running on different CPUs
	cprintf("[%08x] stresssched on CPU %d\n", thisenv->env_id, thisenv->env_cpunum);
  8000ac:	a1 08 40 80 00       	mov    0x804008,%eax
  8000b1:	8b 50 5c             	mov    0x5c(%eax),%edx
  8000b4:	8b 40 48             	mov    0x48(%eax),%eax
  8000b7:	83 ec 04             	sub    $0x4,%esp
  8000ba:	52                   	push   %edx
  8000bb:	50                   	push   %eax
  8000bc:	68 9b 23 80 00       	push   $0x80239b
  8000c1:	e8 7a 01 00 00       	call   800240 <cprintf>
  8000c6:	83 c4 10             	add    $0x10,%esp

}
  8000c9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8000cc:	5b                   	pop    %ebx
  8000cd:	5e                   	pop    %esi
  8000ce:	5d                   	pop    %ebp
  8000cf:	c3                   	ret    
		panic("ran on two CPUs at once (counter is %d)", counter);
  8000d0:	a1 04 40 80 00       	mov    0x804004,%eax
  8000d5:	50                   	push   %eax
  8000d6:	68 60 23 80 00       	push   $0x802360
  8000db:	6a 21                	push   $0x21
  8000dd:	68 88 23 80 00       	push   $0x802388
  8000e2:	e8 72 00 00 00       	call   800159 <_panic>

008000e7 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8000e7:	f3 0f 1e fb          	endbr32 
  8000eb:	55                   	push   %ebp
  8000ec:	89 e5                	mov    %esp,%ebp
  8000ee:	56                   	push   %esi
  8000ef:	53                   	push   %ebx
  8000f0:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8000f3:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8000f6:	c7 05 08 40 80 00 00 	movl   $0x0,0x804008
  8000fd:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800100:	e8 10 0b 00 00       	call   800c15 <sys_getenvid>
  800105:	25 ff 03 00 00       	and    $0x3ff,%eax
  80010a:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80010d:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  800112:	a3 08 40 80 00       	mov    %eax,0x804008

	// save the name of the program so that panic() can use it
	if (argc > 0)
  800117:	85 db                	test   %ebx,%ebx
  800119:	7e 07                	jle    800122 <libmain+0x3b>
		binaryname = argv[0];
  80011b:	8b 06                	mov    (%esi),%eax
  80011d:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  800122:	83 ec 08             	sub    $0x8,%esp
  800125:	56                   	push   %esi
  800126:	53                   	push   %ebx
  800127:	e8 07 ff ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  80012c:	e8 0a 00 00 00       	call   80013b <exit>
}
  800131:	83 c4 10             	add    $0x10,%esp
  800134:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800137:	5b                   	pop    %ebx
  800138:	5e                   	pop    %esi
  800139:	5d                   	pop    %ebp
  80013a:	c3                   	ret    

0080013b <exit>:

#include <inc/lib.h>

void
exit(void)
{
  80013b:	f3 0f 1e fb          	endbr32 
  80013f:	55                   	push   %ebp
  800140:	89 e5                	mov    %esp,%ebp
  800142:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800145:	e8 52 12 00 00       	call   80139c <close_all>
	sys_env_destroy(0);
  80014a:	83 ec 0c             	sub    $0xc,%esp
  80014d:	6a 00                	push   $0x0
  80014f:	e8 7c 0a 00 00       	call   800bd0 <sys_env_destroy>
}
  800154:	83 c4 10             	add    $0x10,%esp
  800157:	c9                   	leave  
  800158:	c3                   	ret    

00800159 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  800159:	f3 0f 1e fb          	endbr32 
  80015d:	55                   	push   %ebp
  80015e:	89 e5                	mov    %esp,%ebp
  800160:	56                   	push   %esi
  800161:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800162:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  800165:	8b 35 00 30 80 00    	mov    0x803000,%esi
  80016b:	e8 a5 0a 00 00       	call   800c15 <sys_getenvid>
  800170:	83 ec 0c             	sub    $0xc,%esp
  800173:	ff 75 0c             	pushl  0xc(%ebp)
  800176:	ff 75 08             	pushl  0x8(%ebp)
  800179:	56                   	push   %esi
  80017a:	50                   	push   %eax
  80017b:	68 c4 23 80 00       	push   $0x8023c4
  800180:	e8 bb 00 00 00       	call   800240 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  800185:	83 c4 18             	add    $0x18,%esp
  800188:	53                   	push   %ebx
  800189:	ff 75 10             	pushl  0x10(%ebp)
  80018c:	e8 5a 00 00 00       	call   8001eb <vcprintf>
	cprintf("\n");
  800191:	c7 04 24 b7 23 80 00 	movl   $0x8023b7,(%esp)
  800198:	e8 a3 00 00 00       	call   800240 <cprintf>
  80019d:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  8001a0:	cc                   	int3   
  8001a1:	eb fd                	jmp    8001a0 <_panic+0x47>

008001a3 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  8001a3:	f3 0f 1e fb          	endbr32 
  8001a7:	55                   	push   %ebp
  8001a8:	89 e5                	mov    %esp,%ebp
  8001aa:	53                   	push   %ebx
  8001ab:	83 ec 04             	sub    $0x4,%esp
  8001ae:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  8001b1:	8b 13                	mov    (%ebx),%edx
  8001b3:	8d 42 01             	lea    0x1(%edx),%eax
  8001b6:	89 03                	mov    %eax,(%ebx)
  8001b8:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8001bb:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8001bf:	3d ff 00 00 00       	cmp    $0xff,%eax
  8001c4:	74 09                	je     8001cf <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8001c6:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8001ca:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8001cd:	c9                   	leave  
  8001ce:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8001cf:	83 ec 08             	sub    $0x8,%esp
  8001d2:	68 ff 00 00 00       	push   $0xff
  8001d7:	8d 43 08             	lea    0x8(%ebx),%eax
  8001da:	50                   	push   %eax
  8001db:	e8 ab 09 00 00       	call   800b8b <sys_cputs>
		b->idx = 0;
  8001e0:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8001e6:	83 c4 10             	add    $0x10,%esp
  8001e9:	eb db                	jmp    8001c6 <putch+0x23>

008001eb <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8001eb:	f3 0f 1e fb          	endbr32 
  8001ef:	55                   	push   %ebp
  8001f0:	89 e5                	mov    %esp,%ebp
  8001f2:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8001f8:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8001ff:	00 00 00 
	b.cnt = 0;
  800202:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  800209:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  80020c:	ff 75 0c             	pushl  0xc(%ebp)
  80020f:	ff 75 08             	pushl  0x8(%ebp)
  800212:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  800218:	50                   	push   %eax
  800219:	68 a3 01 80 00       	push   $0x8001a3
  80021e:	e8 20 01 00 00       	call   800343 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  800223:	83 c4 08             	add    $0x8,%esp
  800226:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  80022c:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800232:	50                   	push   %eax
  800233:	e8 53 09 00 00       	call   800b8b <sys_cputs>

	return b.cnt;
}
  800238:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  80023e:	c9                   	leave  
  80023f:	c3                   	ret    

00800240 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800240:	f3 0f 1e fb          	endbr32 
  800244:	55                   	push   %ebp
  800245:	89 e5                	mov    %esp,%ebp
  800247:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  80024a:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  80024d:	50                   	push   %eax
  80024e:	ff 75 08             	pushl  0x8(%ebp)
  800251:	e8 95 ff ff ff       	call   8001eb <vcprintf>
	va_end(ap);

	return cnt;
}
  800256:	c9                   	leave  
  800257:	c3                   	ret    

00800258 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  800258:	55                   	push   %ebp
  800259:	89 e5                	mov    %esp,%ebp
  80025b:	57                   	push   %edi
  80025c:	56                   	push   %esi
  80025d:	53                   	push   %ebx
  80025e:	83 ec 1c             	sub    $0x1c,%esp
  800261:	89 c7                	mov    %eax,%edi
  800263:	89 d6                	mov    %edx,%esi
  800265:	8b 45 08             	mov    0x8(%ebp),%eax
  800268:	8b 55 0c             	mov    0xc(%ebp),%edx
  80026b:	89 d1                	mov    %edx,%ecx
  80026d:	89 c2                	mov    %eax,%edx
  80026f:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800272:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800275:	8b 45 10             	mov    0x10(%ebp),%eax
  800278:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  80027b:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80027e:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800285:	39 c2                	cmp    %eax,%edx
  800287:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  80028a:	72 3e                	jb     8002ca <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  80028c:	83 ec 0c             	sub    $0xc,%esp
  80028f:	ff 75 18             	pushl  0x18(%ebp)
  800292:	83 eb 01             	sub    $0x1,%ebx
  800295:	53                   	push   %ebx
  800296:	50                   	push   %eax
  800297:	83 ec 08             	sub    $0x8,%esp
  80029a:	ff 75 e4             	pushl  -0x1c(%ebp)
  80029d:	ff 75 e0             	pushl  -0x20(%ebp)
  8002a0:	ff 75 dc             	pushl  -0x24(%ebp)
  8002a3:	ff 75 d8             	pushl  -0x28(%ebp)
  8002a6:	e8 45 1e 00 00       	call   8020f0 <__udivdi3>
  8002ab:	83 c4 18             	add    $0x18,%esp
  8002ae:	52                   	push   %edx
  8002af:	50                   	push   %eax
  8002b0:	89 f2                	mov    %esi,%edx
  8002b2:	89 f8                	mov    %edi,%eax
  8002b4:	e8 9f ff ff ff       	call   800258 <printnum>
  8002b9:	83 c4 20             	add    $0x20,%esp
  8002bc:	eb 13                	jmp    8002d1 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8002be:	83 ec 08             	sub    $0x8,%esp
  8002c1:	56                   	push   %esi
  8002c2:	ff 75 18             	pushl  0x18(%ebp)
  8002c5:	ff d7                	call   *%edi
  8002c7:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8002ca:	83 eb 01             	sub    $0x1,%ebx
  8002cd:	85 db                	test   %ebx,%ebx
  8002cf:	7f ed                	jg     8002be <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8002d1:	83 ec 08             	sub    $0x8,%esp
  8002d4:	56                   	push   %esi
  8002d5:	83 ec 04             	sub    $0x4,%esp
  8002d8:	ff 75 e4             	pushl  -0x1c(%ebp)
  8002db:	ff 75 e0             	pushl  -0x20(%ebp)
  8002de:	ff 75 dc             	pushl  -0x24(%ebp)
  8002e1:	ff 75 d8             	pushl  -0x28(%ebp)
  8002e4:	e8 17 1f 00 00       	call   802200 <__umoddi3>
  8002e9:	83 c4 14             	add    $0x14,%esp
  8002ec:	0f be 80 e7 23 80 00 	movsbl 0x8023e7(%eax),%eax
  8002f3:	50                   	push   %eax
  8002f4:	ff d7                	call   *%edi
}
  8002f6:	83 c4 10             	add    $0x10,%esp
  8002f9:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8002fc:	5b                   	pop    %ebx
  8002fd:	5e                   	pop    %esi
  8002fe:	5f                   	pop    %edi
  8002ff:	5d                   	pop    %ebp
  800300:	c3                   	ret    

00800301 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800301:	f3 0f 1e fb          	endbr32 
  800305:	55                   	push   %ebp
  800306:	89 e5                	mov    %esp,%ebp
  800308:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  80030b:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  80030f:	8b 10                	mov    (%eax),%edx
  800311:	3b 50 04             	cmp    0x4(%eax),%edx
  800314:	73 0a                	jae    800320 <sprintputch+0x1f>
		*b->buf++ = ch;
  800316:	8d 4a 01             	lea    0x1(%edx),%ecx
  800319:	89 08                	mov    %ecx,(%eax)
  80031b:	8b 45 08             	mov    0x8(%ebp),%eax
  80031e:	88 02                	mov    %al,(%edx)
}
  800320:	5d                   	pop    %ebp
  800321:	c3                   	ret    

00800322 <printfmt>:
{
  800322:	f3 0f 1e fb          	endbr32 
  800326:	55                   	push   %ebp
  800327:	89 e5                	mov    %esp,%ebp
  800329:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  80032c:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  80032f:	50                   	push   %eax
  800330:	ff 75 10             	pushl  0x10(%ebp)
  800333:	ff 75 0c             	pushl  0xc(%ebp)
  800336:	ff 75 08             	pushl  0x8(%ebp)
  800339:	e8 05 00 00 00       	call   800343 <vprintfmt>
}
  80033e:	83 c4 10             	add    $0x10,%esp
  800341:	c9                   	leave  
  800342:	c3                   	ret    

00800343 <vprintfmt>:
{
  800343:	f3 0f 1e fb          	endbr32 
  800347:	55                   	push   %ebp
  800348:	89 e5                	mov    %esp,%ebp
  80034a:	57                   	push   %edi
  80034b:	56                   	push   %esi
  80034c:	53                   	push   %ebx
  80034d:	83 ec 3c             	sub    $0x3c,%esp
  800350:	8b 75 08             	mov    0x8(%ebp),%esi
  800353:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800356:	8b 7d 10             	mov    0x10(%ebp),%edi
  800359:	e9 5d 03 00 00       	jmp    8006bb <vprintfmt+0x378>
		padc = ' ';
  80035e:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800362:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800369:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800370:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  800377:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80037c:	8d 47 01             	lea    0x1(%edi),%eax
  80037f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800382:	0f b6 17             	movzbl (%edi),%edx
  800385:	8d 42 dd             	lea    -0x23(%edx),%eax
  800388:	3c 55                	cmp    $0x55,%al
  80038a:	0f 87 ae 03 00 00    	ja     80073e <vprintfmt+0x3fb>
  800390:	0f b6 c0             	movzbl %al,%eax
  800393:	3e ff 24 85 20 25 80 	notrack jmp *0x802520(,%eax,4)
  80039a:	00 
  80039b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  80039e:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  8003a2:	eb d8                	jmp    80037c <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003a4:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  8003a7:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  8003ab:	eb cf                	jmp    80037c <vprintfmt+0x39>
  8003ad:	0f b6 d2             	movzbl %dl,%edx
  8003b0:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  8003b3:	b8 00 00 00 00       	mov    $0x0,%eax
  8003b8:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8003bb:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8003be:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8003c2:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8003c5:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8003c8:	83 f9 09             	cmp    $0x9,%ecx
  8003cb:	77 55                	ja     800422 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8003cd:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8003d0:	eb e9                	jmp    8003bb <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8003d2:	8b 45 14             	mov    0x14(%ebp),%eax
  8003d5:	8b 00                	mov    (%eax),%eax
  8003d7:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003da:	8b 45 14             	mov    0x14(%ebp),%eax
  8003dd:	8d 40 04             	lea    0x4(%eax),%eax
  8003e0:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003e3:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8003e6:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8003ea:	79 90                	jns    80037c <vprintfmt+0x39>
				width = precision, precision = -1;
  8003ec:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8003ef:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8003f2:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8003f9:	eb 81                	jmp    80037c <vprintfmt+0x39>
  8003fb:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8003fe:	85 c0                	test   %eax,%eax
  800400:	ba 00 00 00 00       	mov    $0x0,%edx
  800405:	0f 49 d0             	cmovns %eax,%edx
  800408:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80040b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  80040e:	e9 69 ff ff ff       	jmp    80037c <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800413:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  800416:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  80041d:	e9 5a ff ff ff       	jmp    80037c <vprintfmt+0x39>
  800422:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  800425:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800428:	eb bc                	jmp    8003e6 <vprintfmt+0xa3>
			lflag++;
  80042a:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80042d:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800430:	e9 47 ff ff ff       	jmp    80037c <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  800435:	8b 45 14             	mov    0x14(%ebp),%eax
  800438:	8d 78 04             	lea    0x4(%eax),%edi
  80043b:	83 ec 08             	sub    $0x8,%esp
  80043e:	53                   	push   %ebx
  80043f:	ff 30                	pushl  (%eax)
  800441:	ff d6                	call   *%esi
			break;
  800443:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  800446:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800449:	e9 6a 02 00 00       	jmp    8006b8 <vprintfmt+0x375>
			err = va_arg(ap, int);
  80044e:	8b 45 14             	mov    0x14(%ebp),%eax
  800451:	8d 78 04             	lea    0x4(%eax),%edi
  800454:	8b 00                	mov    (%eax),%eax
  800456:	99                   	cltd   
  800457:	31 d0                	xor    %edx,%eax
  800459:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  80045b:	83 f8 0f             	cmp    $0xf,%eax
  80045e:	7f 23                	jg     800483 <vprintfmt+0x140>
  800460:	8b 14 85 80 26 80 00 	mov    0x802680(,%eax,4),%edx
  800467:	85 d2                	test   %edx,%edx
  800469:	74 18                	je     800483 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  80046b:	52                   	push   %edx
  80046c:	68 01 29 80 00       	push   $0x802901
  800471:	53                   	push   %ebx
  800472:	56                   	push   %esi
  800473:	e8 aa fe ff ff       	call   800322 <printfmt>
  800478:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80047b:	89 7d 14             	mov    %edi,0x14(%ebp)
  80047e:	e9 35 02 00 00       	jmp    8006b8 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800483:	50                   	push   %eax
  800484:	68 ff 23 80 00       	push   $0x8023ff
  800489:	53                   	push   %ebx
  80048a:	56                   	push   %esi
  80048b:	e8 92 fe ff ff       	call   800322 <printfmt>
  800490:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800493:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  800496:	e9 1d 02 00 00       	jmp    8006b8 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  80049b:	8b 45 14             	mov    0x14(%ebp),%eax
  80049e:	83 c0 04             	add    $0x4,%eax
  8004a1:	89 45 c8             	mov    %eax,-0x38(%ebp)
  8004a4:	8b 45 14             	mov    0x14(%ebp),%eax
  8004a7:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  8004a9:	85 d2                	test   %edx,%edx
  8004ab:	b8 f8 23 80 00       	mov    $0x8023f8,%eax
  8004b0:	0f 45 c2             	cmovne %edx,%eax
  8004b3:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  8004b6:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8004ba:	7e 06                	jle    8004c2 <vprintfmt+0x17f>
  8004bc:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8004c0:	75 0d                	jne    8004cf <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8004c2:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8004c5:	89 c7                	mov    %eax,%edi
  8004c7:	03 45 d4             	add    -0x2c(%ebp),%eax
  8004ca:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004cd:	eb 55                	jmp    800524 <vprintfmt+0x1e1>
  8004cf:	83 ec 08             	sub    $0x8,%esp
  8004d2:	ff 75 d8             	pushl  -0x28(%ebp)
  8004d5:	ff 75 cc             	pushl  -0x34(%ebp)
  8004d8:	e8 15 03 00 00       	call   8007f2 <strnlen>
  8004dd:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8004e0:	29 c2                	sub    %eax,%edx
  8004e2:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8004e5:	83 c4 10             	add    $0x10,%esp
  8004e8:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8004ea:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8004ee:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8004f1:	85 ff                	test   %edi,%edi
  8004f3:	7e 11                	jle    800506 <vprintfmt+0x1c3>
					putch(padc, putdat);
  8004f5:	83 ec 08             	sub    $0x8,%esp
  8004f8:	53                   	push   %ebx
  8004f9:	ff 75 d4             	pushl  -0x2c(%ebp)
  8004fc:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8004fe:	83 ef 01             	sub    $0x1,%edi
  800501:	83 c4 10             	add    $0x10,%esp
  800504:	eb eb                	jmp    8004f1 <vprintfmt+0x1ae>
  800506:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800509:	85 d2                	test   %edx,%edx
  80050b:	b8 00 00 00 00       	mov    $0x0,%eax
  800510:	0f 49 c2             	cmovns %edx,%eax
  800513:	29 c2                	sub    %eax,%edx
  800515:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800518:	eb a8                	jmp    8004c2 <vprintfmt+0x17f>
					putch(ch, putdat);
  80051a:	83 ec 08             	sub    $0x8,%esp
  80051d:	53                   	push   %ebx
  80051e:	52                   	push   %edx
  80051f:	ff d6                	call   *%esi
  800521:	83 c4 10             	add    $0x10,%esp
  800524:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  800527:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800529:	83 c7 01             	add    $0x1,%edi
  80052c:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800530:	0f be d0             	movsbl %al,%edx
  800533:	85 d2                	test   %edx,%edx
  800535:	74 4b                	je     800582 <vprintfmt+0x23f>
  800537:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  80053b:	78 06                	js     800543 <vprintfmt+0x200>
  80053d:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800541:	78 1e                	js     800561 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  800543:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  800547:	74 d1                	je     80051a <vprintfmt+0x1d7>
  800549:	0f be c0             	movsbl %al,%eax
  80054c:	83 e8 20             	sub    $0x20,%eax
  80054f:	83 f8 5e             	cmp    $0x5e,%eax
  800552:	76 c6                	jbe    80051a <vprintfmt+0x1d7>
					putch('?', putdat);
  800554:	83 ec 08             	sub    $0x8,%esp
  800557:	53                   	push   %ebx
  800558:	6a 3f                	push   $0x3f
  80055a:	ff d6                	call   *%esi
  80055c:	83 c4 10             	add    $0x10,%esp
  80055f:	eb c3                	jmp    800524 <vprintfmt+0x1e1>
  800561:	89 cf                	mov    %ecx,%edi
  800563:	eb 0e                	jmp    800573 <vprintfmt+0x230>
				putch(' ', putdat);
  800565:	83 ec 08             	sub    $0x8,%esp
  800568:	53                   	push   %ebx
  800569:	6a 20                	push   $0x20
  80056b:	ff d6                	call   *%esi
			for (; width > 0; width--)
  80056d:	83 ef 01             	sub    $0x1,%edi
  800570:	83 c4 10             	add    $0x10,%esp
  800573:	85 ff                	test   %edi,%edi
  800575:	7f ee                	jg     800565 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  800577:	8b 45 c8             	mov    -0x38(%ebp),%eax
  80057a:	89 45 14             	mov    %eax,0x14(%ebp)
  80057d:	e9 36 01 00 00       	jmp    8006b8 <vprintfmt+0x375>
  800582:	89 cf                	mov    %ecx,%edi
  800584:	eb ed                	jmp    800573 <vprintfmt+0x230>
	if (lflag >= 2)
  800586:	83 f9 01             	cmp    $0x1,%ecx
  800589:	7f 1f                	jg     8005aa <vprintfmt+0x267>
	else if (lflag)
  80058b:	85 c9                	test   %ecx,%ecx
  80058d:	74 67                	je     8005f6 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  80058f:	8b 45 14             	mov    0x14(%ebp),%eax
  800592:	8b 00                	mov    (%eax),%eax
  800594:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800597:	89 c1                	mov    %eax,%ecx
  800599:	c1 f9 1f             	sar    $0x1f,%ecx
  80059c:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80059f:	8b 45 14             	mov    0x14(%ebp),%eax
  8005a2:	8d 40 04             	lea    0x4(%eax),%eax
  8005a5:	89 45 14             	mov    %eax,0x14(%ebp)
  8005a8:	eb 17                	jmp    8005c1 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  8005aa:	8b 45 14             	mov    0x14(%ebp),%eax
  8005ad:	8b 50 04             	mov    0x4(%eax),%edx
  8005b0:	8b 00                	mov    (%eax),%eax
  8005b2:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005b5:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8005b8:	8b 45 14             	mov    0x14(%ebp),%eax
  8005bb:	8d 40 08             	lea    0x8(%eax),%eax
  8005be:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  8005c1:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005c4:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  8005c7:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8005cc:	85 c9                	test   %ecx,%ecx
  8005ce:	0f 89 ca 00 00 00    	jns    80069e <vprintfmt+0x35b>
				putch('-', putdat);
  8005d4:	83 ec 08             	sub    $0x8,%esp
  8005d7:	53                   	push   %ebx
  8005d8:	6a 2d                	push   $0x2d
  8005da:	ff d6                	call   *%esi
				num = -(long long) num;
  8005dc:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005df:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8005e2:	f7 da                	neg    %edx
  8005e4:	83 d1 00             	adc    $0x0,%ecx
  8005e7:	f7 d9                	neg    %ecx
  8005e9:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8005ec:	b8 0a 00 00 00       	mov    $0xa,%eax
  8005f1:	e9 a8 00 00 00       	jmp    80069e <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8005f6:	8b 45 14             	mov    0x14(%ebp),%eax
  8005f9:	8b 00                	mov    (%eax),%eax
  8005fb:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005fe:	99                   	cltd   
  8005ff:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800602:	8b 45 14             	mov    0x14(%ebp),%eax
  800605:	8d 40 04             	lea    0x4(%eax),%eax
  800608:	89 45 14             	mov    %eax,0x14(%ebp)
  80060b:	eb b4                	jmp    8005c1 <vprintfmt+0x27e>
	if (lflag >= 2)
  80060d:	83 f9 01             	cmp    $0x1,%ecx
  800610:	7f 1b                	jg     80062d <vprintfmt+0x2ea>
	else if (lflag)
  800612:	85 c9                	test   %ecx,%ecx
  800614:	74 2c                	je     800642 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  800616:	8b 45 14             	mov    0x14(%ebp),%eax
  800619:	8b 10                	mov    (%eax),%edx
  80061b:	b9 00 00 00 00       	mov    $0x0,%ecx
  800620:	8d 40 04             	lea    0x4(%eax),%eax
  800623:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800626:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  80062b:	eb 71                	jmp    80069e <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  80062d:	8b 45 14             	mov    0x14(%ebp),%eax
  800630:	8b 10                	mov    (%eax),%edx
  800632:	8b 48 04             	mov    0x4(%eax),%ecx
  800635:	8d 40 08             	lea    0x8(%eax),%eax
  800638:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80063b:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800640:	eb 5c                	jmp    80069e <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800642:	8b 45 14             	mov    0x14(%ebp),%eax
  800645:	8b 10                	mov    (%eax),%edx
  800647:	b9 00 00 00 00       	mov    $0x0,%ecx
  80064c:	8d 40 04             	lea    0x4(%eax),%eax
  80064f:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800652:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  800657:	eb 45                	jmp    80069e <vprintfmt+0x35b>
			putch('X', putdat);
  800659:	83 ec 08             	sub    $0x8,%esp
  80065c:	53                   	push   %ebx
  80065d:	6a 58                	push   $0x58
  80065f:	ff d6                	call   *%esi
			putch('X', putdat);
  800661:	83 c4 08             	add    $0x8,%esp
  800664:	53                   	push   %ebx
  800665:	6a 58                	push   $0x58
  800667:	ff d6                	call   *%esi
			putch('X', putdat);
  800669:	83 c4 08             	add    $0x8,%esp
  80066c:	53                   	push   %ebx
  80066d:	6a 58                	push   $0x58
  80066f:	ff d6                	call   *%esi
			break;
  800671:	83 c4 10             	add    $0x10,%esp
  800674:	eb 42                	jmp    8006b8 <vprintfmt+0x375>
			putch('0', putdat);
  800676:	83 ec 08             	sub    $0x8,%esp
  800679:	53                   	push   %ebx
  80067a:	6a 30                	push   $0x30
  80067c:	ff d6                	call   *%esi
			putch('x', putdat);
  80067e:	83 c4 08             	add    $0x8,%esp
  800681:	53                   	push   %ebx
  800682:	6a 78                	push   $0x78
  800684:	ff d6                	call   *%esi
			num = (unsigned long long)
  800686:	8b 45 14             	mov    0x14(%ebp),%eax
  800689:	8b 10                	mov    (%eax),%edx
  80068b:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800690:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800693:	8d 40 04             	lea    0x4(%eax),%eax
  800696:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800699:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  80069e:	83 ec 0c             	sub    $0xc,%esp
  8006a1:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  8006a5:	57                   	push   %edi
  8006a6:	ff 75 d4             	pushl  -0x2c(%ebp)
  8006a9:	50                   	push   %eax
  8006aa:	51                   	push   %ecx
  8006ab:	52                   	push   %edx
  8006ac:	89 da                	mov    %ebx,%edx
  8006ae:	89 f0                	mov    %esi,%eax
  8006b0:	e8 a3 fb ff ff       	call   800258 <printnum>
			break;
  8006b5:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  8006b8:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  8006bb:	83 c7 01             	add    $0x1,%edi
  8006be:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8006c2:	83 f8 25             	cmp    $0x25,%eax
  8006c5:	0f 84 93 fc ff ff    	je     80035e <vprintfmt+0x1b>
			if (ch == '\0')
  8006cb:	85 c0                	test   %eax,%eax
  8006cd:	0f 84 8b 00 00 00    	je     80075e <vprintfmt+0x41b>
			putch(ch, putdat);
  8006d3:	83 ec 08             	sub    $0x8,%esp
  8006d6:	53                   	push   %ebx
  8006d7:	50                   	push   %eax
  8006d8:	ff d6                	call   *%esi
  8006da:	83 c4 10             	add    $0x10,%esp
  8006dd:	eb dc                	jmp    8006bb <vprintfmt+0x378>
	if (lflag >= 2)
  8006df:	83 f9 01             	cmp    $0x1,%ecx
  8006e2:	7f 1b                	jg     8006ff <vprintfmt+0x3bc>
	else if (lflag)
  8006e4:	85 c9                	test   %ecx,%ecx
  8006e6:	74 2c                	je     800714 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8006e8:	8b 45 14             	mov    0x14(%ebp),%eax
  8006eb:	8b 10                	mov    (%eax),%edx
  8006ed:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006f2:	8d 40 04             	lea    0x4(%eax),%eax
  8006f5:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006f8:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8006fd:	eb 9f                	jmp    80069e <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8006ff:	8b 45 14             	mov    0x14(%ebp),%eax
  800702:	8b 10                	mov    (%eax),%edx
  800704:	8b 48 04             	mov    0x4(%eax),%ecx
  800707:	8d 40 08             	lea    0x8(%eax),%eax
  80070a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80070d:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  800712:	eb 8a                	jmp    80069e <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800714:	8b 45 14             	mov    0x14(%ebp),%eax
  800717:	8b 10                	mov    (%eax),%edx
  800719:	b9 00 00 00 00       	mov    $0x0,%ecx
  80071e:	8d 40 04             	lea    0x4(%eax),%eax
  800721:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800724:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800729:	e9 70 ff ff ff       	jmp    80069e <vprintfmt+0x35b>
			putch(ch, putdat);
  80072e:	83 ec 08             	sub    $0x8,%esp
  800731:	53                   	push   %ebx
  800732:	6a 25                	push   $0x25
  800734:	ff d6                	call   *%esi
			break;
  800736:	83 c4 10             	add    $0x10,%esp
  800739:	e9 7a ff ff ff       	jmp    8006b8 <vprintfmt+0x375>
			putch('%', putdat);
  80073e:	83 ec 08             	sub    $0x8,%esp
  800741:	53                   	push   %ebx
  800742:	6a 25                	push   $0x25
  800744:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  800746:	83 c4 10             	add    $0x10,%esp
  800749:	89 f8                	mov    %edi,%eax
  80074b:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  80074f:	74 05                	je     800756 <vprintfmt+0x413>
  800751:	83 e8 01             	sub    $0x1,%eax
  800754:	eb f5                	jmp    80074b <vprintfmt+0x408>
  800756:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800759:	e9 5a ff ff ff       	jmp    8006b8 <vprintfmt+0x375>
}
  80075e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800761:	5b                   	pop    %ebx
  800762:	5e                   	pop    %esi
  800763:	5f                   	pop    %edi
  800764:	5d                   	pop    %ebp
  800765:	c3                   	ret    

00800766 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800766:	f3 0f 1e fb          	endbr32 
  80076a:	55                   	push   %ebp
  80076b:	89 e5                	mov    %esp,%ebp
  80076d:	83 ec 18             	sub    $0x18,%esp
  800770:	8b 45 08             	mov    0x8(%ebp),%eax
  800773:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800776:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800779:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  80077d:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800780:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  800787:	85 c0                	test   %eax,%eax
  800789:	74 26                	je     8007b1 <vsnprintf+0x4b>
  80078b:	85 d2                	test   %edx,%edx
  80078d:	7e 22                	jle    8007b1 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  80078f:	ff 75 14             	pushl  0x14(%ebp)
  800792:	ff 75 10             	pushl  0x10(%ebp)
  800795:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800798:	50                   	push   %eax
  800799:	68 01 03 80 00       	push   $0x800301
  80079e:	e8 a0 fb ff ff       	call   800343 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  8007a3:	8b 45 ec             	mov    -0x14(%ebp),%eax
  8007a6:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  8007a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8007ac:	83 c4 10             	add    $0x10,%esp
}
  8007af:	c9                   	leave  
  8007b0:	c3                   	ret    
		return -E_INVAL;
  8007b1:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8007b6:	eb f7                	jmp    8007af <vsnprintf+0x49>

008007b8 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  8007b8:	f3 0f 1e fb          	endbr32 
  8007bc:	55                   	push   %ebp
  8007bd:	89 e5                	mov    %esp,%ebp
  8007bf:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  8007c2:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  8007c5:	50                   	push   %eax
  8007c6:	ff 75 10             	pushl  0x10(%ebp)
  8007c9:	ff 75 0c             	pushl  0xc(%ebp)
  8007cc:	ff 75 08             	pushl  0x8(%ebp)
  8007cf:	e8 92 ff ff ff       	call   800766 <vsnprintf>
	va_end(ap);

	return rc;
}
  8007d4:	c9                   	leave  
  8007d5:	c3                   	ret    

008007d6 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8007d6:	f3 0f 1e fb          	endbr32 
  8007da:	55                   	push   %ebp
  8007db:	89 e5                	mov    %esp,%ebp
  8007dd:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8007e0:	b8 00 00 00 00       	mov    $0x0,%eax
  8007e5:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8007e9:	74 05                	je     8007f0 <strlen+0x1a>
		n++;
  8007eb:	83 c0 01             	add    $0x1,%eax
  8007ee:	eb f5                	jmp    8007e5 <strlen+0xf>
	return n;
}
  8007f0:	5d                   	pop    %ebp
  8007f1:	c3                   	ret    

008007f2 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8007f2:	f3 0f 1e fb          	endbr32 
  8007f6:	55                   	push   %ebp
  8007f7:	89 e5                	mov    %esp,%ebp
  8007f9:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007fc:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8007ff:	b8 00 00 00 00       	mov    $0x0,%eax
  800804:	39 d0                	cmp    %edx,%eax
  800806:	74 0d                	je     800815 <strnlen+0x23>
  800808:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  80080c:	74 05                	je     800813 <strnlen+0x21>
		n++;
  80080e:	83 c0 01             	add    $0x1,%eax
  800811:	eb f1                	jmp    800804 <strnlen+0x12>
  800813:	89 c2                	mov    %eax,%edx
	return n;
}
  800815:	89 d0                	mov    %edx,%eax
  800817:	5d                   	pop    %ebp
  800818:	c3                   	ret    

00800819 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800819:	f3 0f 1e fb          	endbr32 
  80081d:	55                   	push   %ebp
  80081e:	89 e5                	mov    %esp,%ebp
  800820:	53                   	push   %ebx
  800821:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800824:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  800827:	b8 00 00 00 00       	mov    $0x0,%eax
  80082c:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800830:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  800833:	83 c0 01             	add    $0x1,%eax
  800836:	84 d2                	test   %dl,%dl
  800838:	75 f2                	jne    80082c <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  80083a:	89 c8                	mov    %ecx,%eax
  80083c:	5b                   	pop    %ebx
  80083d:	5d                   	pop    %ebp
  80083e:	c3                   	ret    

0080083f <strcat>:

char *
strcat(char *dst, const char *src)
{
  80083f:	f3 0f 1e fb          	endbr32 
  800843:	55                   	push   %ebp
  800844:	89 e5                	mov    %esp,%ebp
  800846:	53                   	push   %ebx
  800847:	83 ec 10             	sub    $0x10,%esp
  80084a:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  80084d:	53                   	push   %ebx
  80084e:	e8 83 ff ff ff       	call   8007d6 <strlen>
  800853:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  800856:	ff 75 0c             	pushl  0xc(%ebp)
  800859:	01 d8                	add    %ebx,%eax
  80085b:	50                   	push   %eax
  80085c:	e8 b8 ff ff ff       	call   800819 <strcpy>
	return dst;
}
  800861:	89 d8                	mov    %ebx,%eax
  800863:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800866:	c9                   	leave  
  800867:	c3                   	ret    

00800868 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800868:	f3 0f 1e fb          	endbr32 
  80086c:	55                   	push   %ebp
  80086d:	89 e5                	mov    %esp,%ebp
  80086f:	56                   	push   %esi
  800870:	53                   	push   %ebx
  800871:	8b 75 08             	mov    0x8(%ebp),%esi
  800874:	8b 55 0c             	mov    0xc(%ebp),%edx
  800877:	89 f3                	mov    %esi,%ebx
  800879:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  80087c:	89 f0                	mov    %esi,%eax
  80087e:	39 d8                	cmp    %ebx,%eax
  800880:	74 11                	je     800893 <strncpy+0x2b>
		*dst++ = *src;
  800882:	83 c0 01             	add    $0x1,%eax
  800885:	0f b6 0a             	movzbl (%edx),%ecx
  800888:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  80088b:	80 f9 01             	cmp    $0x1,%cl
  80088e:	83 da ff             	sbb    $0xffffffff,%edx
  800891:	eb eb                	jmp    80087e <strncpy+0x16>
	}
	return ret;
}
  800893:	89 f0                	mov    %esi,%eax
  800895:	5b                   	pop    %ebx
  800896:	5e                   	pop    %esi
  800897:	5d                   	pop    %ebp
  800898:	c3                   	ret    

00800899 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800899:	f3 0f 1e fb          	endbr32 
  80089d:	55                   	push   %ebp
  80089e:	89 e5                	mov    %esp,%ebp
  8008a0:	56                   	push   %esi
  8008a1:	53                   	push   %ebx
  8008a2:	8b 75 08             	mov    0x8(%ebp),%esi
  8008a5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8008a8:	8b 55 10             	mov    0x10(%ebp),%edx
  8008ab:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  8008ad:	85 d2                	test   %edx,%edx
  8008af:	74 21                	je     8008d2 <strlcpy+0x39>
  8008b1:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  8008b5:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  8008b7:	39 c2                	cmp    %eax,%edx
  8008b9:	74 14                	je     8008cf <strlcpy+0x36>
  8008bb:	0f b6 19             	movzbl (%ecx),%ebx
  8008be:	84 db                	test   %bl,%bl
  8008c0:	74 0b                	je     8008cd <strlcpy+0x34>
			*dst++ = *src++;
  8008c2:	83 c1 01             	add    $0x1,%ecx
  8008c5:	83 c2 01             	add    $0x1,%edx
  8008c8:	88 5a ff             	mov    %bl,-0x1(%edx)
  8008cb:	eb ea                	jmp    8008b7 <strlcpy+0x1e>
  8008cd:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8008cf:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8008d2:	29 f0                	sub    %esi,%eax
}
  8008d4:	5b                   	pop    %ebx
  8008d5:	5e                   	pop    %esi
  8008d6:	5d                   	pop    %ebp
  8008d7:	c3                   	ret    

008008d8 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8008d8:	f3 0f 1e fb          	endbr32 
  8008dc:	55                   	push   %ebp
  8008dd:	89 e5                	mov    %esp,%ebp
  8008df:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008e2:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8008e5:	0f b6 01             	movzbl (%ecx),%eax
  8008e8:	84 c0                	test   %al,%al
  8008ea:	74 0c                	je     8008f8 <strcmp+0x20>
  8008ec:	3a 02                	cmp    (%edx),%al
  8008ee:	75 08                	jne    8008f8 <strcmp+0x20>
		p++, q++;
  8008f0:	83 c1 01             	add    $0x1,%ecx
  8008f3:	83 c2 01             	add    $0x1,%edx
  8008f6:	eb ed                	jmp    8008e5 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8008f8:	0f b6 c0             	movzbl %al,%eax
  8008fb:	0f b6 12             	movzbl (%edx),%edx
  8008fe:	29 d0                	sub    %edx,%eax
}
  800900:	5d                   	pop    %ebp
  800901:	c3                   	ret    

00800902 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800902:	f3 0f 1e fb          	endbr32 
  800906:	55                   	push   %ebp
  800907:	89 e5                	mov    %esp,%ebp
  800909:	53                   	push   %ebx
  80090a:	8b 45 08             	mov    0x8(%ebp),%eax
  80090d:	8b 55 0c             	mov    0xc(%ebp),%edx
  800910:	89 c3                	mov    %eax,%ebx
  800912:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  800915:	eb 06                	jmp    80091d <strncmp+0x1b>
		n--, p++, q++;
  800917:	83 c0 01             	add    $0x1,%eax
  80091a:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  80091d:	39 d8                	cmp    %ebx,%eax
  80091f:	74 16                	je     800937 <strncmp+0x35>
  800921:	0f b6 08             	movzbl (%eax),%ecx
  800924:	84 c9                	test   %cl,%cl
  800926:	74 04                	je     80092c <strncmp+0x2a>
  800928:	3a 0a                	cmp    (%edx),%cl
  80092a:	74 eb                	je     800917 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  80092c:	0f b6 00             	movzbl (%eax),%eax
  80092f:	0f b6 12             	movzbl (%edx),%edx
  800932:	29 d0                	sub    %edx,%eax
}
  800934:	5b                   	pop    %ebx
  800935:	5d                   	pop    %ebp
  800936:	c3                   	ret    
		return 0;
  800937:	b8 00 00 00 00       	mov    $0x0,%eax
  80093c:	eb f6                	jmp    800934 <strncmp+0x32>

0080093e <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  80093e:	f3 0f 1e fb          	endbr32 
  800942:	55                   	push   %ebp
  800943:	89 e5                	mov    %esp,%ebp
  800945:	8b 45 08             	mov    0x8(%ebp),%eax
  800948:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  80094c:	0f b6 10             	movzbl (%eax),%edx
  80094f:	84 d2                	test   %dl,%dl
  800951:	74 09                	je     80095c <strchr+0x1e>
		if (*s == c)
  800953:	38 ca                	cmp    %cl,%dl
  800955:	74 0a                	je     800961 <strchr+0x23>
	for (; *s; s++)
  800957:	83 c0 01             	add    $0x1,%eax
  80095a:	eb f0                	jmp    80094c <strchr+0xe>
			return (char *) s;
	return 0;
  80095c:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800961:	5d                   	pop    %ebp
  800962:	c3                   	ret    

00800963 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800963:	f3 0f 1e fb          	endbr32 
  800967:	55                   	push   %ebp
  800968:	89 e5                	mov    %esp,%ebp
  80096a:	8b 45 08             	mov    0x8(%ebp),%eax
  80096d:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800971:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800974:	38 ca                	cmp    %cl,%dl
  800976:	74 09                	je     800981 <strfind+0x1e>
  800978:	84 d2                	test   %dl,%dl
  80097a:	74 05                	je     800981 <strfind+0x1e>
	for (; *s; s++)
  80097c:	83 c0 01             	add    $0x1,%eax
  80097f:	eb f0                	jmp    800971 <strfind+0xe>
			break;
	return (char *) s;
}
  800981:	5d                   	pop    %ebp
  800982:	c3                   	ret    

00800983 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800983:	f3 0f 1e fb          	endbr32 
  800987:	55                   	push   %ebp
  800988:	89 e5                	mov    %esp,%ebp
  80098a:	57                   	push   %edi
  80098b:	56                   	push   %esi
  80098c:	53                   	push   %ebx
  80098d:	8b 7d 08             	mov    0x8(%ebp),%edi
  800990:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800993:	85 c9                	test   %ecx,%ecx
  800995:	74 31                	je     8009c8 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800997:	89 f8                	mov    %edi,%eax
  800999:	09 c8                	or     %ecx,%eax
  80099b:	a8 03                	test   $0x3,%al
  80099d:	75 23                	jne    8009c2 <memset+0x3f>
		c &= 0xFF;
  80099f:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  8009a3:	89 d3                	mov    %edx,%ebx
  8009a5:	c1 e3 08             	shl    $0x8,%ebx
  8009a8:	89 d0                	mov    %edx,%eax
  8009aa:	c1 e0 18             	shl    $0x18,%eax
  8009ad:	89 d6                	mov    %edx,%esi
  8009af:	c1 e6 10             	shl    $0x10,%esi
  8009b2:	09 f0                	or     %esi,%eax
  8009b4:	09 c2                	or     %eax,%edx
  8009b6:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  8009b8:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  8009bb:	89 d0                	mov    %edx,%eax
  8009bd:	fc                   	cld    
  8009be:	f3 ab                	rep stos %eax,%es:(%edi)
  8009c0:	eb 06                	jmp    8009c8 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  8009c2:	8b 45 0c             	mov    0xc(%ebp),%eax
  8009c5:	fc                   	cld    
  8009c6:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  8009c8:	89 f8                	mov    %edi,%eax
  8009ca:	5b                   	pop    %ebx
  8009cb:	5e                   	pop    %esi
  8009cc:	5f                   	pop    %edi
  8009cd:	5d                   	pop    %ebp
  8009ce:	c3                   	ret    

008009cf <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  8009cf:	f3 0f 1e fb          	endbr32 
  8009d3:	55                   	push   %ebp
  8009d4:	89 e5                	mov    %esp,%ebp
  8009d6:	57                   	push   %edi
  8009d7:	56                   	push   %esi
  8009d8:	8b 45 08             	mov    0x8(%ebp),%eax
  8009db:	8b 75 0c             	mov    0xc(%ebp),%esi
  8009de:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  8009e1:	39 c6                	cmp    %eax,%esi
  8009e3:	73 32                	jae    800a17 <memmove+0x48>
  8009e5:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  8009e8:	39 c2                	cmp    %eax,%edx
  8009ea:	76 2b                	jbe    800a17 <memmove+0x48>
		s += n;
		d += n;
  8009ec:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009ef:	89 fe                	mov    %edi,%esi
  8009f1:	09 ce                	or     %ecx,%esi
  8009f3:	09 d6                	or     %edx,%esi
  8009f5:	f7 c6 03 00 00 00    	test   $0x3,%esi
  8009fb:	75 0e                	jne    800a0b <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  8009fd:	83 ef 04             	sub    $0x4,%edi
  800a00:	8d 72 fc             	lea    -0x4(%edx),%esi
  800a03:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800a06:	fd                   	std    
  800a07:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a09:	eb 09                	jmp    800a14 <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800a0b:	83 ef 01             	sub    $0x1,%edi
  800a0e:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800a11:	fd                   	std    
  800a12:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800a14:	fc                   	cld    
  800a15:	eb 1a                	jmp    800a31 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a17:	89 c2                	mov    %eax,%edx
  800a19:	09 ca                	or     %ecx,%edx
  800a1b:	09 f2                	or     %esi,%edx
  800a1d:	f6 c2 03             	test   $0x3,%dl
  800a20:	75 0a                	jne    800a2c <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800a22:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800a25:	89 c7                	mov    %eax,%edi
  800a27:	fc                   	cld    
  800a28:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a2a:	eb 05                	jmp    800a31 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800a2c:	89 c7                	mov    %eax,%edi
  800a2e:	fc                   	cld    
  800a2f:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800a31:	5e                   	pop    %esi
  800a32:	5f                   	pop    %edi
  800a33:	5d                   	pop    %ebp
  800a34:	c3                   	ret    

00800a35 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800a35:	f3 0f 1e fb          	endbr32 
  800a39:	55                   	push   %ebp
  800a3a:	89 e5                	mov    %esp,%ebp
  800a3c:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800a3f:	ff 75 10             	pushl  0x10(%ebp)
  800a42:	ff 75 0c             	pushl  0xc(%ebp)
  800a45:	ff 75 08             	pushl  0x8(%ebp)
  800a48:	e8 82 ff ff ff       	call   8009cf <memmove>
}
  800a4d:	c9                   	leave  
  800a4e:	c3                   	ret    

00800a4f <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800a4f:	f3 0f 1e fb          	endbr32 
  800a53:	55                   	push   %ebp
  800a54:	89 e5                	mov    %esp,%ebp
  800a56:	56                   	push   %esi
  800a57:	53                   	push   %ebx
  800a58:	8b 45 08             	mov    0x8(%ebp),%eax
  800a5b:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a5e:	89 c6                	mov    %eax,%esi
  800a60:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a63:	39 f0                	cmp    %esi,%eax
  800a65:	74 1c                	je     800a83 <memcmp+0x34>
		if (*s1 != *s2)
  800a67:	0f b6 08             	movzbl (%eax),%ecx
  800a6a:	0f b6 1a             	movzbl (%edx),%ebx
  800a6d:	38 d9                	cmp    %bl,%cl
  800a6f:	75 08                	jne    800a79 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a71:	83 c0 01             	add    $0x1,%eax
  800a74:	83 c2 01             	add    $0x1,%edx
  800a77:	eb ea                	jmp    800a63 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a79:	0f b6 c1             	movzbl %cl,%eax
  800a7c:	0f b6 db             	movzbl %bl,%ebx
  800a7f:	29 d8                	sub    %ebx,%eax
  800a81:	eb 05                	jmp    800a88 <memcmp+0x39>
	}

	return 0;
  800a83:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a88:	5b                   	pop    %ebx
  800a89:	5e                   	pop    %esi
  800a8a:	5d                   	pop    %ebp
  800a8b:	c3                   	ret    

00800a8c <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a8c:	f3 0f 1e fb          	endbr32 
  800a90:	55                   	push   %ebp
  800a91:	89 e5                	mov    %esp,%ebp
  800a93:	8b 45 08             	mov    0x8(%ebp),%eax
  800a96:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a99:	89 c2                	mov    %eax,%edx
  800a9b:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a9e:	39 d0                	cmp    %edx,%eax
  800aa0:	73 09                	jae    800aab <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800aa2:	38 08                	cmp    %cl,(%eax)
  800aa4:	74 05                	je     800aab <memfind+0x1f>
	for (; s < ends; s++)
  800aa6:	83 c0 01             	add    $0x1,%eax
  800aa9:	eb f3                	jmp    800a9e <memfind+0x12>
			break;
	return (void *) s;
}
  800aab:	5d                   	pop    %ebp
  800aac:	c3                   	ret    

00800aad <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800aad:	f3 0f 1e fb          	endbr32 
  800ab1:	55                   	push   %ebp
  800ab2:	89 e5                	mov    %esp,%ebp
  800ab4:	57                   	push   %edi
  800ab5:	56                   	push   %esi
  800ab6:	53                   	push   %ebx
  800ab7:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800aba:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800abd:	eb 03                	jmp    800ac2 <strtol+0x15>
		s++;
  800abf:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800ac2:	0f b6 01             	movzbl (%ecx),%eax
  800ac5:	3c 20                	cmp    $0x20,%al
  800ac7:	74 f6                	je     800abf <strtol+0x12>
  800ac9:	3c 09                	cmp    $0x9,%al
  800acb:	74 f2                	je     800abf <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800acd:	3c 2b                	cmp    $0x2b,%al
  800acf:	74 2a                	je     800afb <strtol+0x4e>
	int neg = 0;
  800ad1:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800ad6:	3c 2d                	cmp    $0x2d,%al
  800ad8:	74 2b                	je     800b05 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800ada:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800ae0:	75 0f                	jne    800af1 <strtol+0x44>
  800ae2:	80 39 30             	cmpb   $0x30,(%ecx)
  800ae5:	74 28                	je     800b0f <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800ae7:	85 db                	test   %ebx,%ebx
  800ae9:	b8 0a 00 00 00       	mov    $0xa,%eax
  800aee:	0f 44 d8             	cmove  %eax,%ebx
  800af1:	b8 00 00 00 00       	mov    $0x0,%eax
  800af6:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800af9:	eb 46                	jmp    800b41 <strtol+0x94>
		s++;
  800afb:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800afe:	bf 00 00 00 00       	mov    $0x0,%edi
  800b03:	eb d5                	jmp    800ada <strtol+0x2d>
		s++, neg = 1;
  800b05:	83 c1 01             	add    $0x1,%ecx
  800b08:	bf 01 00 00 00       	mov    $0x1,%edi
  800b0d:	eb cb                	jmp    800ada <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800b0f:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800b13:	74 0e                	je     800b23 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800b15:	85 db                	test   %ebx,%ebx
  800b17:	75 d8                	jne    800af1 <strtol+0x44>
		s++, base = 8;
  800b19:	83 c1 01             	add    $0x1,%ecx
  800b1c:	bb 08 00 00 00       	mov    $0x8,%ebx
  800b21:	eb ce                	jmp    800af1 <strtol+0x44>
		s += 2, base = 16;
  800b23:	83 c1 02             	add    $0x2,%ecx
  800b26:	bb 10 00 00 00       	mov    $0x10,%ebx
  800b2b:	eb c4                	jmp    800af1 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800b2d:	0f be d2             	movsbl %dl,%edx
  800b30:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800b33:	3b 55 10             	cmp    0x10(%ebp),%edx
  800b36:	7d 3a                	jge    800b72 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800b38:	83 c1 01             	add    $0x1,%ecx
  800b3b:	0f af 45 10          	imul   0x10(%ebp),%eax
  800b3f:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800b41:	0f b6 11             	movzbl (%ecx),%edx
  800b44:	8d 72 d0             	lea    -0x30(%edx),%esi
  800b47:	89 f3                	mov    %esi,%ebx
  800b49:	80 fb 09             	cmp    $0x9,%bl
  800b4c:	76 df                	jbe    800b2d <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800b4e:	8d 72 9f             	lea    -0x61(%edx),%esi
  800b51:	89 f3                	mov    %esi,%ebx
  800b53:	80 fb 19             	cmp    $0x19,%bl
  800b56:	77 08                	ja     800b60 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800b58:	0f be d2             	movsbl %dl,%edx
  800b5b:	83 ea 57             	sub    $0x57,%edx
  800b5e:	eb d3                	jmp    800b33 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800b60:	8d 72 bf             	lea    -0x41(%edx),%esi
  800b63:	89 f3                	mov    %esi,%ebx
  800b65:	80 fb 19             	cmp    $0x19,%bl
  800b68:	77 08                	ja     800b72 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800b6a:	0f be d2             	movsbl %dl,%edx
  800b6d:	83 ea 37             	sub    $0x37,%edx
  800b70:	eb c1                	jmp    800b33 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b72:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b76:	74 05                	je     800b7d <strtol+0xd0>
		*endptr = (char *) s;
  800b78:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b7b:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b7d:	89 c2                	mov    %eax,%edx
  800b7f:	f7 da                	neg    %edx
  800b81:	85 ff                	test   %edi,%edi
  800b83:	0f 45 c2             	cmovne %edx,%eax
}
  800b86:	5b                   	pop    %ebx
  800b87:	5e                   	pop    %esi
  800b88:	5f                   	pop    %edi
  800b89:	5d                   	pop    %ebp
  800b8a:	c3                   	ret    

00800b8b <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b8b:	f3 0f 1e fb          	endbr32 
  800b8f:	55                   	push   %ebp
  800b90:	89 e5                	mov    %esp,%ebp
  800b92:	57                   	push   %edi
  800b93:	56                   	push   %esi
  800b94:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b95:	b8 00 00 00 00       	mov    $0x0,%eax
  800b9a:	8b 55 08             	mov    0x8(%ebp),%edx
  800b9d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ba0:	89 c3                	mov    %eax,%ebx
  800ba2:	89 c7                	mov    %eax,%edi
  800ba4:	89 c6                	mov    %eax,%esi
  800ba6:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800ba8:	5b                   	pop    %ebx
  800ba9:	5e                   	pop    %esi
  800baa:	5f                   	pop    %edi
  800bab:	5d                   	pop    %ebp
  800bac:	c3                   	ret    

00800bad <sys_cgetc>:

int
sys_cgetc(void)
{
  800bad:	f3 0f 1e fb          	endbr32 
  800bb1:	55                   	push   %ebp
  800bb2:	89 e5                	mov    %esp,%ebp
  800bb4:	57                   	push   %edi
  800bb5:	56                   	push   %esi
  800bb6:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bb7:	ba 00 00 00 00       	mov    $0x0,%edx
  800bbc:	b8 01 00 00 00       	mov    $0x1,%eax
  800bc1:	89 d1                	mov    %edx,%ecx
  800bc3:	89 d3                	mov    %edx,%ebx
  800bc5:	89 d7                	mov    %edx,%edi
  800bc7:	89 d6                	mov    %edx,%esi
  800bc9:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800bcb:	5b                   	pop    %ebx
  800bcc:	5e                   	pop    %esi
  800bcd:	5f                   	pop    %edi
  800bce:	5d                   	pop    %ebp
  800bcf:	c3                   	ret    

00800bd0 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800bd0:	f3 0f 1e fb          	endbr32 
  800bd4:	55                   	push   %ebp
  800bd5:	89 e5                	mov    %esp,%ebp
  800bd7:	57                   	push   %edi
  800bd8:	56                   	push   %esi
  800bd9:	53                   	push   %ebx
  800bda:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bdd:	b9 00 00 00 00       	mov    $0x0,%ecx
  800be2:	8b 55 08             	mov    0x8(%ebp),%edx
  800be5:	b8 03 00 00 00       	mov    $0x3,%eax
  800bea:	89 cb                	mov    %ecx,%ebx
  800bec:	89 cf                	mov    %ecx,%edi
  800bee:	89 ce                	mov    %ecx,%esi
  800bf0:	cd 30                	int    $0x30
	if(check && ret > 0)
  800bf2:	85 c0                	test   %eax,%eax
  800bf4:	7f 08                	jg     800bfe <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800bf6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800bf9:	5b                   	pop    %ebx
  800bfa:	5e                   	pop    %esi
  800bfb:	5f                   	pop    %edi
  800bfc:	5d                   	pop    %ebp
  800bfd:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800bfe:	83 ec 0c             	sub    $0xc,%esp
  800c01:	50                   	push   %eax
  800c02:	6a 03                	push   $0x3
  800c04:	68 df 26 80 00       	push   $0x8026df
  800c09:	6a 23                	push   $0x23
  800c0b:	68 fc 26 80 00       	push   $0x8026fc
  800c10:	e8 44 f5 ff ff       	call   800159 <_panic>

00800c15 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800c15:	f3 0f 1e fb          	endbr32 
  800c19:	55                   	push   %ebp
  800c1a:	89 e5                	mov    %esp,%ebp
  800c1c:	57                   	push   %edi
  800c1d:	56                   	push   %esi
  800c1e:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c1f:	ba 00 00 00 00       	mov    $0x0,%edx
  800c24:	b8 02 00 00 00       	mov    $0x2,%eax
  800c29:	89 d1                	mov    %edx,%ecx
  800c2b:	89 d3                	mov    %edx,%ebx
  800c2d:	89 d7                	mov    %edx,%edi
  800c2f:	89 d6                	mov    %edx,%esi
  800c31:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800c33:	5b                   	pop    %ebx
  800c34:	5e                   	pop    %esi
  800c35:	5f                   	pop    %edi
  800c36:	5d                   	pop    %ebp
  800c37:	c3                   	ret    

00800c38 <sys_yield>:

void
sys_yield(void)
{
  800c38:	f3 0f 1e fb          	endbr32 
  800c3c:	55                   	push   %ebp
  800c3d:	89 e5                	mov    %esp,%ebp
  800c3f:	57                   	push   %edi
  800c40:	56                   	push   %esi
  800c41:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c42:	ba 00 00 00 00       	mov    $0x0,%edx
  800c47:	b8 0b 00 00 00       	mov    $0xb,%eax
  800c4c:	89 d1                	mov    %edx,%ecx
  800c4e:	89 d3                	mov    %edx,%ebx
  800c50:	89 d7                	mov    %edx,%edi
  800c52:	89 d6                	mov    %edx,%esi
  800c54:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800c56:	5b                   	pop    %ebx
  800c57:	5e                   	pop    %esi
  800c58:	5f                   	pop    %edi
  800c59:	5d                   	pop    %ebp
  800c5a:	c3                   	ret    

00800c5b <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800c5b:	f3 0f 1e fb          	endbr32 
  800c5f:	55                   	push   %ebp
  800c60:	89 e5                	mov    %esp,%ebp
  800c62:	57                   	push   %edi
  800c63:	56                   	push   %esi
  800c64:	53                   	push   %ebx
  800c65:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c68:	be 00 00 00 00       	mov    $0x0,%esi
  800c6d:	8b 55 08             	mov    0x8(%ebp),%edx
  800c70:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c73:	b8 04 00 00 00       	mov    $0x4,%eax
  800c78:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c7b:	89 f7                	mov    %esi,%edi
  800c7d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c7f:	85 c0                	test   %eax,%eax
  800c81:	7f 08                	jg     800c8b <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c83:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c86:	5b                   	pop    %ebx
  800c87:	5e                   	pop    %esi
  800c88:	5f                   	pop    %edi
  800c89:	5d                   	pop    %ebp
  800c8a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c8b:	83 ec 0c             	sub    $0xc,%esp
  800c8e:	50                   	push   %eax
  800c8f:	6a 04                	push   $0x4
  800c91:	68 df 26 80 00       	push   $0x8026df
  800c96:	6a 23                	push   $0x23
  800c98:	68 fc 26 80 00       	push   $0x8026fc
  800c9d:	e8 b7 f4 ff ff       	call   800159 <_panic>

00800ca2 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800ca2:	f3 0f 1e fb          	endbr32 
  800ca6:	55                   	push   %ebp
  800ca7:	89 e5                	mov    %esp,%ebp
  800ca9:	57                   	push   %edi
  800caa:	56                   	push   %esi
  800cab:	53                   	push   %ebx
  800cac:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800caf:	8b 55 08             	mov    0x8(%ebp),%edx
  800cb2:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cb5:	b8 05 00 00 00       	mov    $0x5,%eax
  800cba:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800cbd:	8b 7d 14             	mov    0x14(%ebp),%edi
  800cc0:	8b 75 18             	mov    0x18(%ebp),%esi
  800cc3:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cc5:	85 c0                	test   %eax,%eax
  800cc7:	7f 08                	jg     800cd1 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800cc9:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ccc:	5b                   	pop    %ebx
  800ccd:	5e                   	pop    %esi
  800cce:	5f                   	pop    %edi
  800ccf:	5d                   	pop    %ebp
  800cd0:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cd1:	83 ec 0c             	sub    $0xc,%esp
  800cd4:	50                   	push   %eax
  800cd5:	6a 05                	push   $0x5
  800cd7:	68 df 26 80 00       	push   $0x8026df
  800cdc:	6a 23                	push   $0x23
  800cde:	68 fc 26 80 00       	push   $0x8026fc
  800ce3:	e8 71 f4 ff ff       	call   800159 <_panic>

00800ce8 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800ce8:	f3 0f 1e fb          	endbr32 
  800cec:	55                   	push   %ebp
  800ced:	89 e5                	mov    %esp,%ebp
  800cef:	57                   	push   %edi
  800cf0:	56                   	push   %esi
  800cf1:	53                   	push   %ebx
  800cf2:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cf5:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cfa:	8b 55 08             	mov    0x8(%ebp),%edx
  800cfd:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d00:	b8 06 00 00 00       	mov    $0x6,%eax
  800d05:	89 df                	mov    %ebx,%edi
  800d07:	89 de                	mov    %ebx,%esi
  800d09:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d0b:	85 c0                	test   %eax,%eax
  800d0d:	7f 08                	jg     800d17 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800d0f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d12:	5b                   	pop    %ebx
  800d13:	5e                   	pop    %esi
  800d14:	5f                   	pop    %edi
  800d15:	5d                   	pop    %ebp
  800d16:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d17:	83 ec 0c             	sub    $0xc,%esp
  800d1a:	50                   	push   %eax
  800d1b:	6a 06                	push   $0x6
  800d1d:	68 df 26 80 00       	push   $0x8026df
  800d22:	6a 23                	push   $0x23
  800d24:	68 fc 26 80 00       	push   $0x8026fc
  800d29:	e8 2b f4 ff ff       	call   800159 <_panic>

00800d2e <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800d2e:	f3 0f 1e fb          	endbr32 
  800d32:	55                   	push   %ebp
  800d33:	89 e5                	mov    %esp,%ebp
  800d35:	57                   	push   %edi
  800d36:	56                   	push   %esi
  800d37:	53                   	push   %ebx
  800d38:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d3b:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d40:	8b 55 08             	mov    0x8(%ebp),%edx
  800d43:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d46:	b8 08 00 00 00       	mov    $0x8,%eax
  800d4b:	89 df                	mov    %ebx,%edi
  800d4d:	89 de                	mov    %ebx,%esi
  800d4f:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d51:	85 c0                	test   %eax,%eax
  800d53:	7f 08                	jg     800d5d <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800d55:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d58:	5b                   	pop    %ebx
  800d59:	5e                   	pop    %esi
  800d5a:	5f                   	pop    %edi
  800d5b:	5d                   	pop    %ebp
  800d5c:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d5d:	83 ec 0c             	sub    $0xc,%esp
  800d60:	50                   	push   %eax
  800d61:	6a 08                	push   $0x8
  800d63:	68 df 26 80 00       	push   $0x8026df
  800d68:	6a 23                	push   $0x23
  800d6a:	68 fc 26 80 00       	push   $0x8026fc
  800d6f:	e8 e5 f3 ff ff       	call   800159 <_panic>

00800d74 <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d74:	f3 0f 1e fb          	endbr32 
  800d78:	55                   	push   %ebp
  800d79:	89 e5                	mov    %esp,%ebp
  800d7b:	57                   	push   %edi
  800d7c:	56                   	push   %esi
  800d7d:	53                   	push   %ebx
  800d7e:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d81:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d86:	8b 55 08             	mov    0x8(%ebp),%edx
  800d89:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d8c:	b8 09 00 00 00       	mov    $0x9,%eax
  800d91:	89 df                	mov    %ebx,%edi
  800d93:	89 de                	mov    %ebx,%esi
  800d95:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d97:	85 c0                	test   %eax,%eax
  800d99:	7f 08                	jg     800da3 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d9b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d9e:	5b                   	pop    %ebx
  800d9f:	5e                   	pop    %esi
  800da0:	5f                   	pop    %edi
  800da1:	5d                   	pop    %ebp
  800da2:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800da3:	83 ec 0c             	sub    $0xc,%esp
  800da6:	50                   	push   %eax
  800da7:	6a 09                	push   $0x9
  800da9:	68 df 26 80 00       	push   $0x8026df
  800dae:	6a 23                	push   $0x23
  800db0:	68 fc 26 80 00       	push   $0x8026fc
  800db5:	e8 9f f3 ff ff       	call   800159 <_panic>

00800dba <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800dba:	f3 0f 1e fb          	endbr32 
  800dbe:	55                   	push   %ebp
  800dbf:	89 e5                	mov    %esp,%ebp
  800dc1:	57                   	push   %edi
  800dc2:	56                   	push   %esi
  800dc3:	53                   	push   %ebx
  800dc4:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800dc7:	bb 00 00 00 00       	mov    $0x0,%ebx
  800dcc:	8b 55 08             	mov    0x8(%ebp),%edx
  800dcf:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800dd2:	b8 0a 00 00 00       	mov    $0xa,%eax
  800dd7:	89 df                	mov    %ebx,%edi
  800dd9:	89 de                	mov    %ebx,%esi
  800ddb:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ddd:	85 c0                	test   %eax,%eax
  800ddf:	7f 08                	jg     800de9 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800de1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800de4:	5b                   	pop    %ebx
  800de5:	5e                   	pop    %esi
  800de6:	5f                   	pop    %edi
  800de7:	5d                   	pop    %ebp
  800de8:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800de9:	83 ec 0c             	sub    $0xc,%esp
  800dec:	50                   	push   %eax
  800ded:	6a 0a                	push   $0xa
  800def:	68 df 26 80 00       	push   $0x8026df
  800df4:	6a 23                	push   $0x23
  800df6:	68 fc 26 80 00       	push   $0x8026fc
  800dfb:	e8 59 f3 ff ff       	call   800159 <_panic>

00800e00 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800e00:	f3 0f 1e fb          	endbr32 
  800e04:	55                   	push   %ebp
  800e05:	89 e5                	mov    %esp,%ebp
  800e07:	57                   	push   %edi
  800e08:	56                   	push   %esi
  800e09:	53                   	push   %ebx
	asm volatile("int %1\n"
  800e0a:	8b 55 08             	mov    0x8(%ebp),%edx
  800e0d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e10:	b8 0c 00 00 00       	mov    $0xc,%eax
  800e15:	be 00 00 00 00       	mov    $0x0,%esi
  800e1a:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800e1d:	8b 7d 14             	mov    0x14(%ebp),%edi
  800e20:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800e22:	5b                   	pop    %ebx
  800e23:	5e                   	pop    %esi
  800e24:	5f                   	pop    %edi
  800e25:	5d                   	pop    %ebp
  800e26:	c3                   	ret    

00800e27 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800e27:	f3 0f 1e fb          	endbr32 
  800e2b:	55                   	push   %ebp
  800e2c:	89 e5                	mov    %esp,%ebp
  800e2e:	57                   	push   %edi
  800e2f:	56                   	push   %esi
  800e30:	53                   	push   %ebx
  800e31:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e34:	b9 00 00 00 00       	mov    $0x0,%ecx
  800e39:	8b 55 08             	mov    0x8(%ebp),%edx
  800e3c:	b8 0d 00 00 00       	mov    $0xd,%eax
  800e41:	89 cb                	mov    %ecx,%ebx
  800e43:	89 cf                	mov    %ecx,%edi
  800e45:	89 ce                	mov    %ecx,%esi
  800e47:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e49:	85 c0                	test   %eax,%eax
  800e4b:	7f 08                	jg     800e55 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800e4d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e50:	5b                   	pop    %ebx
  800e51:	5e                   	pop    %esi
  800e52:	5f                   	pop    %edi
  800e53:	5d                   	pop    %ebp
  800e54:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e55:	83 ec 0c             	sub    $0xc,%esp
  800e58:	50                   	push   %eax
  800e59:	6a 0d                	push   $0xd
  800e5b:	68 df 26 80 00       	push   $0x8026df
  800e60:	6a 23                	push   $0x23
  800e62:	68 fc 26 80 00       	push   $0x8026fc
  800e67:	e8 ed f2 ff ff       	call   800159 <_panic>

00800e6c <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800e6c:	f3 0f 1e fb          	endbr32 
  800e70:	55                   	push   %ebp
  800e71:	89 e5                	mov    %esp,%ebp
  800e73:	56                   	push   %esi
  800e74:	53                   	push   %ebx
  800e75:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800e78:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e7a:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800e7e:	0f 84 b2 00 00 00    	je     800f36 <pgfault+0xca>
  800e84:	89 d8                	mov    %ebx,%eax
  800e86:	c1 e8 16             	shr    $0x16,%eax
  800e89:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800e90:	a8 01                	test   $0x1,%al
  800e92:	0f 84 9e 00 00 00    	je     800f36 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e98:	89 d8                	mov    %ebx,%eax
  800e9a:	c1 e8 0c             	shr    $0xc,%eax
  800e9d:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800ea4:	f6 c2 01             	test   $0x1,%dl
  800ea7:	0f 84 89 00 00 00    	je     800f36 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800ead:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800eb4:	f6 c4 08             	test   $0x8,%ah
  800eb7:	74 7d                	je     800f36 <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800eb9:	e8 57 fd ff ff       	call   800c15 <sys_getenvid>
  800ebe:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800ec0:	83 ec 04             	sub    $0x4,%esp
  800ec3:	6a 07                	push   $0x7
  800ec5:	68 00 f0 7f 00       	push   $0x7ff000
  800eca:	50                   	push   %eax
  800ecb:	e8 8b fd ff ff       	call   800c5b <sys_page_alloc>
	if(r<0){
  800ed0:	83 c4 10             	add    $0x10,%esp
  800ed3:	85 c0                	test   %eax,%eax
  800ed5:	78 73                	js     800f4a <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800ed7:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800edd:	83 ec 04             	sub    $0x4,%esp
  800ee0:	68 00 10 00 00       	push   $0x1000
  800ee5:	53                   	push   %ebx
  800ee6:	68 00 f0 7f 00       	push   $0x7ff000
  800eeb:	e8 df fa ff ff       	call   8009cf <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800ef0:	83 c4 08             	add    $0x8,%esp
  800ef3:	53                   	push   %ebx
  800ef4:	56                   	push   %esi
  800ef5:	e8 ee fd ff ff       	call   800ce8 <sys_page_unmap>
	if(r<0)
  800efa:	83 c4 10             	add    $0x10,%esp
  800efd:	85 c0                	test   %eax,%eax
  800eff:	78 5b                	js     800f5c <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800f01:	83 ec 0c             	sub    $0xc,%esp
  800f04:	6a 07                	push   $0x7
  800f06:	53                   	push   %ebx
  800f07:	56                   	push   %esi
  800f08:	68 00 f0 7f 00       	push   $0x7ff000
  800f0d:	56                   	push   %esi
  800f0e:	e8 8f fd ff ff       	call   800ca2 <sys_page_map>
	if(r<0)
  800f13:	83 c4 20             	add    $0x20,%esp
  800f16:	85 c0                	test   %eax,%eax
  800f18:	78 54                	js     800f6e <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  800f1a:	83 ec 08             	sub    $0x8,%esp
  800f1d:	68 00 f0 7f 00       	push   $0x7ff000
  800f22:	56                   	push   %esi
  800f23:	e8 c0 fd ff ff       	call   800ce8 <sys_page_unmap>
	if(r<0)
  800f28:	83 c4 10             	add    $0x10,%esp
  800f2b:	85 c0                	test   %eax,%eax
  800f2d:	78 51                	js     800f80 <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  800f2f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800f32:	5b                   	pop    %ebx
  800f33:	5e                   	pop    %esi
  800f34:	5d                   	pop    %ebp
  800f35:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  800f36:	83 ec 04             	sub    $0x4,%esp
  800f39:	68 0c 27 80 00       	push   $0x80270c
  800f3e:	6a 2c                	push   $0x2c
  800f40:	68 bb 27 80 00       	push   $0x8027bb
  800f45:	e8 0f f2 ff ff       	call   800159 <_panic>
		 panic("pgfault: page allocation failed %e", r);
  800f4a:	50                   	push   %eax
  800f4b:	68 4c 27 80 00       	push   $0x80274c
  800f50:	6a 31                	push   $0x31
  800f52:	68 bb 27 80 00       	push   $0x8027bb
  800f57:	e8 fd f1 ff ff       	call   800159 <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f5c:	50                   	push   %eax
  800f5d:	68 c6 27 80 00       	push   $0x8027c6
  800f62:	6a 3b                	push   $0x3b
  800f64:	68 bb 27 80 00       	push   $0x8027bb
  800f69:	e8 eb f1 ff ff       	call   800159 <_panic>
	panic("pgfault: page map failed %e", r);
  800f6e:	50                   	push   %eax
  800f6f:	68 e4 27 80 00       	push   $0x8027e4
  800f74:	6a 3e                	push   $0x3e
  800f76:	68 bb 27 80 00       	push   $0x8027bb
  800f7b:	e8 d9 f1 ff ff       	call   800159 <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f80:	50                   	push   %eax
  800f81:	68 c6 27 80 00       	push   $0x8027c6
  800f86:	6a 41                	push   $0x41
  800f88:	68 bb 27 80 00       	push   $0x8027bb
  800f8d:	e8 c7 f1 ff ff       	call   800159 <_panic>

00800f92 <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  800f92:	f3 0f 1e fb          	endbr32 
  800f96:	55                   	push   %ebp
  800f97:	89 e5                	mov    %esp,%ebp
  800f99:	57                   	push   %edi
  800f9a:	56                   	push   %esi
  800f9b:	53                   	push   %ebx
  800f9c:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  800f9f:	68 6c 0e 80 00       	push   $0x800e6c
  800fa4:	e8 49 0f 00 00       	call   801ef2 <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  800fa9:	b8 07 00 00 00       	mov    $0x7,%eax
  800fae:	cd 30                	int    $0x30
  800fb0:	89 c7                	mov    %eax,%edi
  800fb2:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  800fb5:	83 c4 10             	add    $0x10,%esp
  800fb8:	85 c0                	test   %eax,%eax
  800fba:	0f 8e 9d 01 00 00    	jle    80115d <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800fc0:	bb 00 00 80 00       	mov    $0x800000,%ebx
  800fc5:	eb 5b                	jmp    801022 <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  800fc7:	83 ec 0c             	sub    $0xc,%esp
  800fca:	68 07 0e 00 00       	push   $0xe07
  800fcf:	56                   	push   %esi
  800fd0:	ff 75 e4             	pushl  -0x1c(%ebp)
  800fd3:	56                   	push   %esi
  800fd4:	6a 00                	push   $0x0
  800fd6:	e8 c7 fc ff ff       	call   800ca2 <sys_page_map>
  800fdb:	83 c4 20             	add    $0x20,%esp
  800fde:	eb 30                	jmp    801010 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  800fe0:	83 ec 04             	sub    $0x4,%esp
  800fe3:	68 00 28 80 00       	push   $0x802800
  800fe8:	6a 63                	push   $0x63
  800fea:	68 bb 27 80 00       	push   $0x8027bb
  800fef:	e8 65 f1 ff ff       	call   800159 <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  800ff4:	83 ec 0c             	sub    $0xc,%esp
  800ff7:	6a 05                	push   $0x5
  800ff9:	56                   	push   %esi
  800ffa:	ff 75 e4             	pushl  -0x1c(%ebp)
  800ffd:	56                   	push   %esi
  800ffe:	6a 00                	push   $0x0
  801000:	e8 9d fc ff ff       	call   800ca2 <sys_page_map>
            if(r < 0)
  801005:	83 c4 20             	add    $0x20,%esp
  801008:	85 c0                	test   %eax,%eax
  80100a:	0f 88 ac 00 00 00    	js     8010bc <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  801010:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  801016:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  80101c:	0f 84 ae 00 00 00    	je     8010d0 <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  801022:	89 d8                	mov    %ebx,%eax
  801024:	c1 e8 16             	shr    $0x16,%eax
  801027:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80102e:	a8 01                	test   $0x1,%al
  801030:	74 de                	je     801010 <fork+0x7e>
			pn=PGNUM(pageVa);
  801032:	89 d8                	mov    %ebx,%eax
  801034:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  801037:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80103e:	f6 c2 01             	test   $0x1,%dl
  801041:	74 cd                	je     801010 <fork+0x7e>
  801043:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80104a:	f6 c2 04             	test   $0x4,%dl
  80104d:	74 c1                	je     801010 <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  80104f:	89 c6                	mov    %eax,%esi
  801051:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  801054:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  80105b:	f6 c4 04             	test   $0x4,%ah
  80105e:	0f 85 63 ff ff ff    	jne    800fc7 <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  801064:	a9 02 08 00 00       	test   $0x802,%eax
  801069:	74 89                	je     800ff4 <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  80106b:	83 ec 0c             	sub    $0xc,%esp
  80106e:	68 05 08 00 00       	push   $0x805
  801073:	56                   	push   %esi
  801074:	ff 75 e4             	pushl  -0x1c(%ebp)
  801077:	56                   	push   %esi
  801078:	6a 00                	push   $0x0
  80107a:	e8 23 fc ff ff       	call   800ca2 <sys_page_map>
            if(r < 0)
  80107f:	83 c4 20             	add    $0x20,%esp
  801082:	85 c0                	test   %eax,%eax
  801084:	0f 88 56 ff ff ff    	js     800fe0 <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  80108a:	83 ec 0c             	sub    $0xc,%esp
  80108d:	68 05 08 00 00       	push   $0x805
  801092:	56                   	push   %esi
  801093:	6a 00                	push   $0x0
  801095:	56                   	push   %esi
  801096:	6a 00                	push   $0x0
  801098:	e8 05 fc ff ff       	call   800ca2 <sys_page_map>
            if(r < 0)
  80109d:	83 c4 20             	add    $0x20,%esp
  8010a0:	85 c0                	test   %eax,%eax
  8010a2:	0f 89 68 ff ff ff    	jns    801010 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  8010a8:	83 ec 04             	sub    $0x4,%esp
  8010ab:	68 00 28 80 00       	push   $0x802800
  8010b0:	6a 66                	push   $0x66
  8010b2:	68 bb 27 80 00       	push   $0x8027bb
  8010b7:	e8 9d f0 ff ff       	call   800159 <_panic>
                panic("duppage: sys_page_map fail\n");
  8010bc:	83 ec 04             	sub    $0x4,%esp
  8010bf:	68 00 28 80 00       	push   $0x802800
  8010c4:	6a 6c                	push   $0x6c
  8010c6:	68 bb 27 80 00       	push   $0x8027bb
  8010cb:	e8 89 f0 ff ff       	call   800159 <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  8010d0:	83 ec 04             	sub    $0x4,%esp
  8010d3:	6a 07                	push   $0x7
  8010d5:	68 00 f0 bf ee       	push   $0xeebff000
  8010da:	57                   	push   %edi
  8010db:	e8 7b fb ff ff       	call   800c5b <sys_page_alloc>
		if(flag<0){
  8010e0:	83 c4 10             	add    $0x10,%esp
  8010e3:	85 c0                	test   %eax,%eax
  8010e5:	78 31                	js     801118 <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  8010e7:	83 ec 08             	sub    $0x8,%esp
  8010ea:	68 6c 1f 80 00       	push   $0x801f6c
  8010ef:	57                   	push   %edi
  8010f0:	e8 c5 fc ff ff       	call   800dba <sys_env_set_pgfault_upcall>
		if(flag<0){
  8010f5:	83 c4 10             	add    $0x10,%esp
  8010f8:	85 c0                	test   %eax,%eax
  8010fa:	78 33                	js     80112f <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  8010fc:	83 ec 08             	sub    $0x8,%esp
  8010ff:	6a 02                	push   $0x2
  801101:	57                   	push   %edi
  801102:	e8 27 fc ff ff       	call   800d2e <sys_env_set_status>
		if(flag<0){
  801107:	83 c4 10             	add    $0x10,%esp
  80110a:	85 c0                	test   %eax,%eax
  80110c:	78 38                	js     801146 <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  80110e:	89 f8                	mov    %edi,%eax
  801110:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801113:	5b                   	pop    %ebx
  801114:	5e                   	pop    %esi
  801115:	5f                   	pop    %edi
  801116:	5d                   	pop    %ebp
  801117:	c3                   	ret    
			panic("panic by alloc page");
  801118:	83 ec 04             	sub    $0x4,%esp
  80111b:	68 1c 28 80 00       	push   $0x80281c
  801120:	68 98 00 00 00       	push   $0x98
  801125:	68 bb 27 80 00       	push   $0x8027bb
  80112a:	e8 2a f0 ff ff       	call   800159 <_panic>
			panic("panic by set pgfault upcall faction");
  80112f:	83 ec 04             	sub    $0x4,%esp
  801132:	68 70 27 80 00       	push   $0x802770
  801137:	68 9e 00 00 00       	push   $0x9e
  80113c:	68 bb 27 80 00       	push   $0x8027bb
  801141:	e8 13 f0 ff ff       	call   800159 <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  801146:	83 ec 04             	sub    $0x4,%esp
  801149:	68 94 27 80 00       	push   $0x802794
  80114e:	68 a3 00 00 00       	push   $0xa3
  801153:	68 bb 27 80 00       	push   $0x8027bb
  801158:	e8 fc ef ff ff       	call   800159 <_panic>
	else if(envid==0){
  80115d:	75 19                	jne    801178 <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  80115f:	e8 b1 fa ff ff       	call   800c15 <sys_getenvid>
  801164:	25 ff 03 00 00       	and    $0x3ff,%eax
  801169:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80116c:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801171:	a3 08 40 80 00       	mov    %eax,0x804008
		return 0;
  801176:	eb 96                	jmp    80110e <fork+0x17c>
		panic("panic by alloc envid");
  801178:	83 ec 04             	sub    $0x4,%esp
  80117b:	68 30 28 80 00       	push   $0x802830
  801180:	68 ad 00 00 00       	push   $0xad
  801185:	68 bb 27 80 00       	push   $0x8027bb
  80118a:	e8 ca ef ff ff       	call   800159 <_panic>

0080118f <sfork>:

// Challenge!
int
sfork(void)
{
  80118f:	f3 0f 1e fb          	endbr32 
  801193:	55                   	push   %ebp
  801194:	89 e5                	mov    %esp,%ebp
  801196:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  801199:	68 45 28 80 00       	push   $0x802845
  80119e:	68 b7 00 00 00       	push   $0xb7
  8011a3:	68 bb 27 80 00       	push   $0x8027bb
  8011a8:	e8 ac ef ff ff       	call   800159 <_panic>

008011ad <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  8011ad:	f3 0f 1e fb          	endbr32 
  8011b1:	55                   	push   %ebp
  8011b2:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8011b4:	8b 45 08             	mov    0x8(%ebp),%eax
  8011b7:	05 00 00 00 30       	add    $0x30000000,%eax
  8011bc:	c1 e8 0c             	shr    $0xc,%eax
}
  8011bf:	5d                   	pop    %ebp
  8011c0:	c3                   	ret    

008011c1 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  8011c1:	f3 0f 1e fb          	endbr32 
  8011c5:	55                   	push   %ebp
  8011c6:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8011c8:	8b 45 08             	mov    0x8(%ebp),%eax
  8011cb:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  8011d0:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  8011d5:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  8011da:	5d                   	pop    %ebp
  8011db:	c3                   	ret    

008011dc <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  8011dc:	f3 0f 1e fb          	endbr32 
  8011e0:	55                   	push   %ebp
  8011e1:	89 e5                	mov    %esp,%ebp
  8011e3:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  8011e8:	89 c2                	mov    %eax,%edx
  8011ea:	c1 ea 16             	shr    $0x16,%edx
  8011ed:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  8011f4:	f6 c2 01             	test   $0x1,%dl
  8011f7:	74 2d                	je     801226 <fd_alloc+0x4a>
  8011f9:	89 c2                	mov    %eax,%edx
  8011fb:	c1 ea 0c             	shr    $0xc,%edx
  8011fe:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801205:	f6 c2 01             	test   $0x1,%dl
  801208:	74 1c                	je     801226 <fd_alloc+0x4a>
  80120a:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  80120f:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  801214:	75 d2                	jne    8011e8 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  801216:	8b 45 08             	mov    0x8(%ebp),%eax
  801219:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  80121f:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  801224:	eb 0a                	jmp    801230 <fd_alloc+0x54>
			*fd_store = fd;
  801226:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801229:	89 01                	mov    %eax,(%ecx)
			return 0;
  80122b:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801230:	5d                   	pop    %ebp
  801231:	c3                   	ret    

00801232 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  801232:	f3 0f 1e fb          	endbr32 
  801236:	55                   	push   %ebp
  801237:	89 e5                	mov    %esp,%ebp
  801239:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  80123c:	83 f8 1f             	cmp    $0x1f,%eax
  80123f:	77 30                	ja     801271 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  801241:	c1 e0 0c             	shl    $0xc,%eax
  801244:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  801249:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  80124f:	f6 c2 01             	test   $0x1,%dl
  801252:	74 24                	je     801278 <fd_lookup+0x46>
  801254:	89 c2                	mov    %eax,%edx
  801256:	c1 ea 0c             	shr    $0xc,%edx
  801259:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801260:	f6 c2 01             	test   $0x1,%dl
  801263:	74 1a                	je     80127f <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  801265:	8b 55 0c             	mov    0xc(%ebp),%edx
  801268:	89 02                	mov    %eax,(%edx)
	return 0;
  80126a:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80126f:	5d                   	pop    %ebp
  801270:	c3                   	ret    
		return -E_INVAL;
  801271:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801276:	eb f7                	jmp    80126f <fd_lookup+0x3d>
		return -E_INVAL;
  801278:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80127d:	eb f0                	jmp    80126f <fd_lookup+0x3d>
  80127f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801284:	eb e9                	jmp    80126f <fd_lookup+0x3d>

00801286 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  801286:	f3 0f 1e fb          	endbr32 
  80128a:	55                   	push   %ebp
  80128b:	89 e5                	mov    %esp,%ebp
  80128d:	83 ec 08             	sub    $0x8,%esp
  801290:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801293:	ba d8 28 80 00       	mov    $0x8028d8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  801298:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  80129d:	39 08                	cmp    %ecx,(%eax)
  80129f:	74 33                	je     8012d4 <dev_lookup+0x4e>
  8012a1:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  8012a4:	8b 02                	mov    (%edx),%eax
  8012a6:	85 c0                	test   %eax,%eax
  8012a8:	75 f3                	jne    80129d <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  8012aa:	a1 08 40 80 00       	mov    0x804008,%eax
  8012af:	8b 40 48             	mov    0x48(%eax),%eax
  8012b2:	83 ec 04             	sub    $0x4,%esp
  8012b5:	51                   	push   %ecx
  8012b6:	50                   	push   %eax
  8012b7:	68 5c 28 80 00       	push   $0x80285c
  8012bc:	e8 7f ef ff ff       	call   800240 <cprintf>
	*dev = 0;
  8012c1:	8b 45 0c             	mov    0xc(%ebp),%eax
  8012c4:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  8012ca:	83 c4 10             	add    $0x10,%esp
  8012cd:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  8012d2:	c9                   	leave  
  8012d3:	c3                   	ret    
			*dev = devtab[i];
  8012d4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8012d7:	89 01                	mov    %eax,(%ecx)
			return 0;
  8012d9:	b8 00 00 00 00       	mov    $0x0,%eax
  8012de:	eb f2                	jmp    8012d2 <dev_lookup+0x4c>

008012e0 <fd_close>:
{
  8012e0:	f3 0f 1e fb          	endbr32 
  8012e4:	55                   	push   %ebp
  8012e5:	89 e5                	mov    %esp,%ebp
  8012e7:	57                   	push   %edi
  8012e8:	56                   	push   %esi
  8012e9:	53                   	push   %ebx
  8012ea:	83 ec 24             	sub    $0x24,%esp
  8012ed:	8b 75 08             	mov    0x8(%ebp),%esi
  8012f0:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8012f3:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8012f6:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012f7:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  8012fd:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801300:	50                   	push   %eax
  801301:	e8 2c ff ff ff       	call   801232 <fd_lookup>
  801306:	89 c3                	mov    %eax,%ebx
  801308:	83 c4 10             	add    $0x10,%esp
  80130b:	85 c0                	test   %eax,%eax
  80130d:	78 05                	js     801314 <fd_close+0x34>
	    || fd != fd2)
  80130f:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  801312:	74 16                	je     80132a <fd_close+0x4a>
		return (must_exist ? r : 0);
  801314:	89 f8                	mov    %edi,%eax
  801316:	84 c0                	test   %al,%al
  801318:	b8 00 00 00 00       	mov    $0x0,%eax
  80131d:	0f 44 d8             	cmove  %eax,%ebx
}
  801320:	89 d8                	mov    %ebx,%eax
  801322:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801325:	5b                   	pop    %ebx
  801326:	5e                   	pop    %esi
  801327:	5f                   	pop    %edi
  801328:	5d                   	pop    %ebp
  801329:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  80132a:	83 ec 08             	sub    $0x8,%esp
  80132d:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801330:	50                   	push   %eax
  801331:	ff 36                	pushl  (%esi)
  801333:	e8 4e ff ff ff       	call   801286 <dev_lookup>
  801338:	89 c3                	mov    %eax,%ebx
  80133a:	83 c4 10             	add    $0x10,%esp
  80133d:	85 c0                	test   %eax,%eax
  80133f:	78 1a                	js     80135b <fd_close+0x7b>
		if (dev->dev_close)
  801341:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801344:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  801347:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  80134c:	85 c0                	test   %eax,%eax
  80134e:	74 0b                	je     80135b <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  801350:	83 ec 0c             	sub    $0xc,%esp
  801353:	56                   	push   %esi
  801354:	ff d0                	call   *%eax
  801356:	89 c3                	mov    %eax,%ebx
  801358:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  80135b:	83 ec 08             	sub    $0x8,%esp
  80135e:	56                   	push   %esi
  80135f:	6a 00                	push   $0x0
  801361:	e8 82 f9 ff ff       	call   800ce8 <sys_page_unmap>
	return r;
  801366:	83 c4 10             	add    $0x10,%esp
  801369:	eb b5                	jmp    801320 <fd_close+0x40>

0080136b <close>:

int
close(int fdnum)
{
  80136b:	f3 0f 1e fb          	endbr32 
  80136f:	55                   	push   %ebp
  801370:	89 e5                	mov    %esp,%ebp
  801372:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801375:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801378:	50                   	push   %eax
  801379:	ff 75 08             	pushl  0x8(%ebp)
  80137c:	e8 b1 fe ff ff       	call   801232 <fd_lookup>
  801381:	83 c4 10             	add    $0x10,%esp
  801384:	85 c0                	test   %eax,%eax
  801386:	79 02                	jns    80138a <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  801388:	c9                   	leave  
  801389:	c3                   	ret    
		return fd_close(fd, 1);
  80138a:	83 ec 08             	sub    $0x8,%esp
  80138d:	6a 01                	push   $0x1
  80138f:	ff 75 f4             	pushl  -0xc(%ebp)
  801392:	e8 49 ff ff ff       	call   8012e0 <fd_close>
  801397:	83 c4 10             	add    $0x10,%esp
  80139a:	eb ec                	jmp    801388 <close+0x1d>

0080139c <close_all>:

void
close_all(void)
{
  80139c:	f3 0f 1e fb          	endbr32 
  8013a0:	55                   	push   %ebp
  8013a1:	89 e5                	mov    %esp,%ebp
  8013a3:	53                   	push   %ebx
  8013a4:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  8013a7:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  8013ac:	83 ec 0c             	sub    $0xc,%esp
  8013af:	53                   	push   %ebx
  8013b0:	e8 b6 ff ff ff       	call   80136b <close>
	for (i = 0; i < MAXFD; i++)
  8013b5:	83 c3 01             	add    $0x1,%ebx
  8013b8:	83 c4 10             	add    $0x10,%esp
  8013bb:	83 fb 20             	cmp    $0x20,%ebx
  8013be:	75 ec                	jne    8013ac <close_all+0x10>
}
  8013c0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8013c3:	c9                   	leave  
  8013c4:	c3                   	ret    

008013c5 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8013c5:	f3 0f 1e fb          	endbr32 
  8013c9:	55                   	push   %ebp
  8013ca:	89 e5                	mov    %esp,%ebp
  8013cc:	57                   	push   %edi
  8013cd:	56                   	push   %esi
  8013ce:	53                   	push   %ebx
  8013cf:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8013d2:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8013d5:	50                   	push   %eax
  8013d6:	ff 75 08             	pushl  0x8(%ebp)
  8013d9:	e8 54 fe ff ff       	call   801232 <fd_lookup>
  8013de:	89 c3                	mov    %eax,%ebx
  8013e0:	83 c4 10             	add    $0x10,%esp
  8013e3:	85 c0                	test   %eax,%eax
  8013e5:	0f 88 81 00 00 00    	js     80146c <dup+0xa7>
		return r;
	close(newfdnum);
  8013eb:	83 ec 0c             	sub    $0xc,%esp
  8013ee:	ff 75 0c             	pushl  0xc(%ebp)
  8013f1:	e8 75 ff ff ff       	call   80136b <close>

	newfd = INDEX2FD(newfdnum);
  8013f6:	8b 75 0c             	mov    0xc(%ebp),%esi
  8013f9:	c1 e6 0c             	shl    $0xc,%esi
  8013fc:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801402:	83 c4 04             	add    $0x4,%esp
  801405:	ff 75 e4             	pushl  -0x1c(%ebp)
  801408:	e8 b4 fd ff ff       	call   8011c1 <fd2data>
  80140d:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  80140f:	89 34 24             	mov    %esi,(%esp)
  801412:	e8 aa fd ff ff       	call   8011c1 <fd2data>
  801417:	83 c4 10             	add    $0x10,%esp
  80141a:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  80141c:	89 d8                	mov    %ebx,%eax
  80141e:	c1 e8 16             	shr    $0x16,%eax
  801421:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801428:	a8 01                	test   $0x1,%al
  80142a:	74 11                	je     80143d <dup+0x78>
  80142c:	89 d8                	mov    %ebx,%eax
  80142e:	c1 e8 0c             	shr    $0xc,%eax
  801431:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801438:	f6 c2 01             	test   $0x1,%dl
  80143b:	75 39                	jne    801476 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  80143d:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801440:	89 d0                	mov    %edx,%eax
  801442:	c1 e8 0c             	shr    $0xc,%eax
  801445:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80144c:	83 ec 0c             	sub    $0xc,%esp
  80144f:	25 07 0e 00 00       	and    $0xe07,%eax
  801454:	50                   	push   %eax
  801455:	56                   	push   %esi
  801456:	6a 00                	push   $0x0
  801458:	52                   	push   %edx
  801459:	6a 00                	push   $0x0
  80145b:	e8 42 f8 ff ff       	call   800ca2 <sys_page_map>
  801460:	89 c3                	mov    %eax,%ebx
  801462:	83 c4 20             	add    $0x20,%esp
  801465:	85 c0                	test   %eax,%eax
  801467:	78 31                	js     80149a <dup+0xd5>
		goto err;

	return newfdnum;
  801469:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  80146c:	89 d8                	mov    %ebx,%eax
  80146e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801471:	5b                   	pop    %ebx
  801472:	5e                   	pop    %esi
  801473:	5f                   	pop    %edi
  801474:	5d                   	pop    %ebp
  801475:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  801476:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80147d:	83 ec 0c             	sub    $0xc,%esp
  801480:	25 07 0e 00 00       	and    $0xe07,%eax
  801485:	50                   	push   %eax
  801486:	57                   	push   %edi
  801487:	6a 00                	push   $0x0
  801489:	53                   	push   %ebx
  80148a:	6a 00                	push   $0x0
  80148c:	e8 11 f8 ff ff       	call   800ca2 <sys_page_map>
  801491:	89 c3                	mov    %eax,%ebx
  801493:	83 c4 20             	add    $0x20,%esp
  801496:	85 c0                	test   %eax,%eax
  801498:	79 a3                	jns    80143d <dup+0x78>
	sys_page_unmap(0, newfd);
  80149a:	83 ec 08             	sub    $0x8,%esp
  80149d:	56                   	push   %esi
  80149e:	6a 00                	push   $0x0
  8014a0:	e8 43 f8 ff ff       	call   800ce8 <sys_page_unmap>
	sys_page_unmap(0, nva);
  8014a5:	83 c4 08             	add    $0x8,%esp
  8014a8:	57                   	push   %edi
  8014a9:	6a 00                	push   $0x0
  8014ab:	e8 38 f8 ff ff       	call   800ce8 <sys_page_unmap>
	return r;
  8014b0:	83 c4 10             	add    $0x10,%esp
  8014b3:	eb b7                	jmp    80146c <dup+0xa7>

008014b5 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8014b5:	f3 0f 1e fb          	endbr32 
  8014b9:	55                   	push   %ebp
  8014ba:	89 e5                	mov    %esp,%ebp
  8014bc:	53                   	push   %ebx
  8014bd:	83 ec 1c             	sub    $0x1c,%esp
  8014c0:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8014c3:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8014c6:	50                   	push   %eax
  8014c7:	53                   	push   %ebx
  8014c8:	e8 65 fd ff ff       	call   801232 <fd_lookup>
  8014cd:	83 c4 10             	add    $0x10,%esp
  8014d0:	85 c0                	test   %eax,%eax
  8014d2:	78 3f                	js     801513 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8014d4:	83 ec 08             	sub    $0x8,%esp
  8014d7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8014da:	50                   	push   %eax
  8014db:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8014de:	ff 30                	pushl  (%eax)
  8014e0:	e8 a1 fd ff ff       	call   801286 <dev_lookup>
  8014e5:	83 c4 10             	add    $0x10,%esp
  8014e8:	85 c0                	test   %eax,%eax
  8014ea:	78 27                	js     801513 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8014ec:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8014ef:	8b 42 08             	mov    0x8(%edx),%eax
  8014f2:	83 e0 03             	and    $0x3,%eax
  8014f5:	83 f8 01             	cmp    $0x1,%eax
  8014f8:	74 1e                	je     801518 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8014fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8014fd:	8b 40 08             	mov    0x8(%eax),%eax
  801500:	85 c0                	test   %eax,%eax
  801502:	74 35                	je     801539 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  801504:	83 ec 04             	sub    $0x4,%esp
  801507:	ff 75 10             	pushl  0x10(%ebp)
  80150a:	ff 75 0c             	pushl  0xc(%ebp)
  80150d:	52                   	push   %edx
  80150e:	ff d0                	call   *%eax
  801510:	83 c4 10             	add    $0x10,%esp
}
  801513:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801516:	c9                   	leave  
  801517:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  801518:	a1 08 40 80 00       	mov    0x804008,%eax
  80151d:	8b 40 48             	mov    0x48(%eax),%eax
  801520:	83 ec 04             	sub    $0x4,%esp
  801523:	53                   	push   %ebx
  801524:	50                   	push   %eax
  801525:	68 9d 28 80 00       	push   $0x80289d
  80152a:	e8 11 ed ff ff       	call   800240 <cprintf>
		return -E_INVAL;
  80152f:	83 c4 10             	add    $0x10,%esp
  801532:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801537:	eb da                	jmp    801513 <read+0x5e>
		return -E_NOT_SUPP;
  801539:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80153e:	eb d3                	jmp    801513 <read+0x5e>

00801540 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  801540:	f3 0f 1e fb          	endbr32 
  801544:	55                   	push   %ebp
  801545:	89 e5                	mov    %esp,%ebp
  801547:	57                   	push   %edi
  801548:	56                   	push   %esi
  801549:	53                   	push   %ebx
  80154a:	83 ec 0c             	sub    $0xc,%esp
  80154d:	8b 7d 08             	mov    0x8(%ebp),%edi
  801550:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801553:	bb 00 00 00 00       	mov    $0x0,%ebx
  801558:	eb 02                	jmp    80155c <readn+0x1c>
  80155a:	01 c3                	add    %eax,%ebx
  80155c:	39 f3                	cmp    %esi,%ebx
  80155e:	73 21                	jae    801581 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801560:	83 ec 04             	sub    $0x4,%esp
  801563:	89 f0                	mov    %esi,%eax
  801565:	29 d8                	sub    %ebx,%eax
  801567:	50                   	push   %eax
  801568:	89 d8                	mov    %ebx,%eax
  80156a:	03 45 0c             	add    0xc(%ebp),%eax
  80156d:	50                   	push   %eax
  80156e:	57                   	push   %edi
  80156f:	e8 41 ff ff ff       	call   8014b5 <read>
		if (m < 0)
  801574:	83 c4 10             	add    $0x10,%esp
  801577:	85 c0                	test   %eax,%eax
  801579:	78 04                	js     80157f <readn+0x3f>
			return m;
		if (m == 0)
  80157b:	75 dd                	jne    80155a <readn+0x1a>
  80157d:	eb 02                	jmp    801581 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80157f:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  801581:	89 d8                	mov    %ebx,%eax
  801583:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801586:	5b                   	pop    %ebx
  801587:	5e                   	pop    %esi
  801588:	5f                   	pop    %edi
  801589:	5d                   	pop    %ebp
  80158a:	c3                   	ret    

0080158b <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  80158b:	f3 0f 1e fb          	endbr32 
  80158f:	55                   	push   %ebp
  801590:	89 e5                	mov    %esp,%ebp
  801592:	53                   	push   %ebx
  801593:	83 ec 1c             	sub    $0x1c,%esp
  801596:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801599:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80159c:	50                   	push   %eax
  80159d:	53                   	push   %ebx
  80159e:	e8 8f fc ff ff       	call   801232 <fd_lookup>
  8015a3:	83 c4 10             	add    $0x10,%esp
  8015a6:	85 c0                	test   %eax,%eax
  8015a8:	78 3a                	js     8015e4 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8015aa:	83 ec 08             	sub    $0x8,%esp
  8015ad:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015b0:	50                   	push   %eax
  8015b1:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015b4:	ff 30                	pushl  (%eax)
  8015b6:	e8 cb fc ff ff       	call   801286 <dev_lookup>
  8015bb:	83 c4 10             	add    $0x10,%esp
  8015be:	85 c0                	test   %eax,%eax
  8015c0:	78 22                	js     8015e4 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8015c2:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015c5:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8015c9:	74 1e                	je     8015e9 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  8015cb:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8015ce:	8b 52 0c             	mov    0xc(%edx),%edx
  8015d1:	85 d2                	test   %edx,%edx
  8015d3:	74 35                	je     80160a <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  8015d5:	83 ec 04             	sub    $0x4,%esp
  8015d8:	ff 75 10             	pushl  0x10(%ebp)
  8015db:	ff 75 0c             	pushl  0xc(%ebp)
  8015de:	50                   	push   %eax
  8015df:	ff d2                	call   *%edx
  8015e1:	83 c4 10             	add    $0x10,%esp
}
  8015e4:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015e7:	c9                   	leave  
  8015e8:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  8015e9:	a1 08 40 80 00       	mov    0x804008,%eax
  8015ee:	8b 40 48             	mov    0x48(%eax),%eax
  8015f1:	83 ec 04             	sub    $0x4,%esp
  8015f4:	53                   	push   %ebx
  8015f5:	50                   	push   %eax
  8015f6:	68 b9 28 80 00       	push   $0x8028b9
  8015fb:	e8 40 ec ff ff       	call   800240 <cprintf>
		return -E_INVAL;
  801600:	83 c4 10             	add    $0x10,%esp
  801603:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801608:	eb da                	jmp    8015e4 <write+0x59>
		return -E_NOT_SUPP;
  80160a:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80160f:	eb d3                	jmp    8015e4 <write+0x59>

00801611 <seek>:

int
seek(int fdnum, off_t offset)
{
  801611:	f3 0f 1e fb          	endbr32 
  801615:	55                   	push   %ebp
  801616:	89 e5                	mov    %esp,%ebp
  801618:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80161b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80161e:	50                   	push   %eax
  80161f:	ff 75 08             	pushl  0x8(%ebp)
  801622:	e8 0b fc ff ff       	call   801232 <fd_lookup>
  801627:	83 c4 10             	add    $0x10,%esp
  80162a:	85 c0                	test   %eax,%eax
  80162c:	78 0e                	js     80163c <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  80162e:	8b 55 0c             	mov    0xc(%ebp),%edx
  801631:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801634:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801637:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80163c:	c9                   	leave  
  80163d:	c3                   	ret    

0080163e <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  80163e:	f3 0f 1e fb          	endbr32 
  801642:	55                   	push   %ebp
  801643:	89 e5                	mov    %esp,%ebp
  801645:	53                   	push   %ebx
  801646:	83 ec 1c             	sub    $0x1c,%esp
  801649:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  80164c:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80164f:	50                   	push   %eax
  801650:	53                   	push   %ebx
  801651:	e8 dc fb ff ff       	call   801232 <fd_lookup>
  801656:	83 c4 10             	add    $0x10,%esp
  801659:	85 c0                	test   %eax,%eax
  80165b:	78 37                	js     801694 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80165d:	83 ec 08             	sub    $0x8,%esp
  801660:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801663:	50                   	push   %eax
  801664:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801667:	ff 30                	pushl  (%eax)
  801669:	e8 18 fc ff ff       	call   801286 <dev_lookup>
  80166e:	83 c4 10             	add    $0x10,%esp
  801671:	85 c0                	test   %eax,%eax
  801673:	78 1f                	js     801694 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801675:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801678:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  80167c:	74 1b                	je     801699 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  80167e:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801681:	8b 52 18             	mov    0x18(%edx),%edx
  801684:	85 d2                	test   %edx,%edx
  801686:	74 32                	je     8016ba <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  801688:	83 ec 08             	sub    $0x8,%esp
  80168b:	ff 75 0c             	pushl  0xc(%ebp)
  80168e:	50                   	push   %eax
  80168f:	ff d2                	call   *%edx
  801691:	83 c4 10             	add    $0x10,%esp
}
  801694:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801697:	c9                   	leave  
  801698:	c3                   	ret    
			thisenv->env_id, fdnum);
  801699:	a1 08 40 80 00       	mov    0x804008,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  80169e:	8b 40 48             	mov    0x48(%eax),%eax
  8016a1:	83 ec 04             	sub    $0x4,%esp
  8016a4:	53                   	push   %ebx
  8016a5:	50                   	push   %eax
  8016a6:	68 7c 28 80 00       	push   $0x80287c
  8016ab:	e8 90 eb ff ff       	call   800240 <cprintf>
		return -E_INVAL;
  8016b0:	83 c4 10             	add    $0x10,%esp
  8016b3:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8016b8:	eb da                	jmp    801694 <ftruncate+0x56>
		return -E_NOT_SUPP;
  8016ba:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016bf:	eb d3                	jmp    801694 <ftruncate+0x56>

008016c1 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8016c1:	f3 0f 1e fb          	endbr32 
  8016c5:	55                   	push   %ebp
  8016c6:	89 e5                	mov    %esp,%ebp
  8016c8:	53                   	push   %ebx
  8016c9:	83 ec 1c             	sub    $0x1c,%esp
  8016cc:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8016cf:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8016d2:	50                   	push   %eax
  8016d3:	ff 75 08             	pushl  0x8(%ebp)
  8016d6:	e8 57 fb ff ff       	call   801232 <fd_lookup>
  8016db:	83 c4 10             	add    $0x10,%esp
  8016de:	85 c0                	test   %eax,%eax
  8016e0:	78 4b                	js     80172d <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8016e2:	83 ec 08             	sub    $0x8,%esp
  8016e5:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016e8:	50                   	push   %eax
  8016e9:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016ec:	ff 30                	pushl  (%eax)
  8016ee:	e8 93 fb ff ff       	call   801286 <dev_lookup>
  8016f3:	83 c4 10             	add    $0x10,%esp
  8016f6:	85 c0                	test   %eax,%eax
  8016f8:	78 33                	js     80172d <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8016fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8016fd:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801701:	74 2f                	je     801732 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801703:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801706:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  80170d:	00 00 00 
	stat->st_isdir = 0;
  801710:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801717:	00 00 00 
	stat->st_dev = dev;
  80171a:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801720:	83 ec 08             	sub    $0x8,%esp
  801723:	53                   	push   %ebx
  801724:	ff 75 f0             	pushl  -0x10(%ebp)
  801727:	ff 50 14             	call   *0x14(%eax)
  80172a:	83 c4 10             	add    $0x10,%esp
}
  80172d:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801730:	c9                   	leave  
  801731:	c3                   	ret    
		return -E_NOT_SUPP;
  801732:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801737:	eb f4                	jmp    80172d <fstat+0x6c>

00801739 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801739:	f3 0f 1e fb          	endbr32 
  80173d:	55                   	push   %ebp
  80173e:	89 e5                	mov    %esp,%ebp
  801740:	56                   	push   %esi
  801741:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801742:	83 ec 08             	sub    $0x8,%esp
  801745:	6a 00                	push   $0x0
  801747:	ff 75 08             	pushl  0x8(%ebp)
  80174a:	e8 fb 01 00 00       	call   80194a <open>
  80174f:	89 c3                	mov    %eax,%ebx
  801751:	83 c4 10             	add    $0x10,%esp
  801754:	85 c0                	test   %eax,%eax
  801756:	78 1b                	js     801773 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801758:	83 ec 08             	sub    $0x8,%esp
  80175b:	ff 75 0c             	pushl  0xc(%ebp)
  80175e:	50                   	push   %eax
  80175f:	e8 5d ff ff ff       	call   8016c1 <fstat>
  801764:	89 c6                	mov    %eax,%esi
	close(fd);
  801766:	89 1c 24             	mov    %ebx,(%esp)
  801769:	e8 fd fb ff ff       	call   80136b <close>
	return r;
  80176e:	83 c4 10             	add    $0x10,%esp
  801771:	89 f3                	mov    %esi,%ebx
}
  801773:	89 d8                	mov    %ebx,%eax
  801775:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801778:	5b                   	pop    %ebx
  801779:	5e                   	pop    %esi
  80177a:	5d                   	pop    %ebp
  80177b:	c3                   	ret    

0080177c <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  80177c:	55                   	push   %ebp
  80177d:	89 e5                	mov    %esp,%ebp
  80177f:	56                   	push   %esi
  801780:	53                   	push   %ebx
  801781:	89 c6                	mov    %eax,%esi
  801783:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  801785:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  80178c:	74 27                	je     8017b5 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  80178e:	6a 07                	push   $0x7
  801790:	68 00 50 80 00       	push   $0x805000
  801795:	56                   	push   %esi
  801796:	ff 35 00 40 80 00    	pushl  0x804000
  80179c:	e8 73 08 00 00       	call   802014 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  8017a1:	83 c4 0c             	add    $0xc,%esp
  8017a4:	6a 00                	push   $0x0
  8017a6:	53                   	push   %ebx
  8017a7:	6a 00                	push   $0x0
  8017a9:	e8 e5 07 00 00       	call   801f93 <ipc_recv>
}
  8017ae:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8017b1:	5b                   	pop    %ebx
  8017b2:	5e                   	pop    %esi
  8017b3:	5d                   	pop    %ebp
  8017b4:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8017b5:	83 ec 0c             	sub    $0xc,%esp
  8017b8:	6a 01                	push   $0x1
  8017ba:	e8 ad 08 00 00       	call   80206c <ipc_find_env>
  8017bf:	a3 00 40 80 00       	mov    %eax,0x804000
  8017c4:	83 c4 10             	add    $0x10,%esp
  8017c7:	eb c5                	jmp    80178e <fsipc+0x12>

008017c9 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8017c9:	f3 0f 1e fb          	endbr32 
  8017cd:	55                   	push   %ebp
  8017ce:	89 e5                	mov    %esp,%ebp
  8017d0:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  8017d3:	8b 45 08             	mov    0x8(%ebp),%eax
  8017d6:	8b 40 0c             	mov    0xc(%eax),%eax
  8017d9:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  8017de:	8b 45 0c             	mov    0xc(%ebp),%eax
  8017e1:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  8017e6:	ba 00 00 00 00       	mov    $0x0,%edx
  8017eb:	b8 02 00 00 00       	mov    $0x2,%eax
  8017f0:	e8 87 ff ff ff       	call   80177c <fsipc>
}
  8017f5:	c9                   	leave  
  8017f6:	c3                   	ret    

008017f7 <devfile_flush>:
{
  8017f7:	f3 0f 1e fb          	endbr32 
  8017fb:	55                   	push   %ebp
  8017fc:	89 e5                	mov    %esp,%ebp
  8017fe:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801801:	8b 45 08             	mov    0x8(%ebp),%eax
  801804:	8b 40 0c             	mov    0xc(%eax),%eax
  801807:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  80180c:	ba 00 00 00 00       	mov    $0x0,%edx
  801811:	b8 06 00 00 00       	mov    $0x6,%eax
  801816:	e8 61 ff ff ff       	call   80177c <fsipc>
}
  80181b:	c9                   	leave  
  80181c:	c3                   	ret    

0080181d <devfile_stat>:
{
  80181d:	f3 0f 1e fb          	endbr32 
  801821:	55                   	push   %ebp
  801822:	89 e5                	mov    %esp,%ebp
  801824:	53                   	push   %ebx
  801825:	83 ec 04             	sub    $0x4,%esp
  801828:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  80182b:	8b 45 08             	mov    0x8(%ebp),%eax
  80182e:	8b 40 0c             	mov    0xc(%eax),%eax
  801831:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801836:	ba 00 00 00 00       	mov    $0x0,%edx
  80183b:	b8 05 00 00 00       	mov    $0x5,%eax
  801840:	e8 37 ff ff ff       	call   80177c <fsipc>
  801845:	85 c0                	test   %eax,%eax
  801847:	78 2c                	js     801875 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801849:	83 ec 08             	sub    $0x8,%esp
  80184c:	68 00 50 80 00       	push   $0x805000
  801851:	53                   	push   %ebx
  801852:	e8 c2 ef ff ff       	call   800819 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801857:	a1 80 50 80 00       	mov    0x805080,%eax
  80185c:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801862:	a1 84 50 80 00       	mov    0x805084,%eax
  801867:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  80186d:	83 c4 10             	add    $0x10,%esp
  801870:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801875:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801878:	c9                   	leave  
  801879:	c3                   	ret    

0080187a <devfile_write>:
{
  80187a:	f3 0f 1e fb          	endbr32 
  80187e:	55                   	push   %ebp
  80187f:	89 e5                	mov    %esp,%ebp
  801881:	83 ec 0c             	sub    $0xc,%esp
  801884:	8b 45 10             	mov    0x10(%ebp),%eax
  801887:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  80188c:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801891:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801894:	8b 55 08             	mov    0x8(%ebp),%edx
  801897:	8b 52 0c             	mov    0xc(%edx),%edx
  80189a:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  8018a0:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  8018a5:	50                   	push   %eax
  8018a6:	ff 75 0c             	pushl  0xc(%ebp)
  8018a9:	68 08 50 80 00       	push   $0x805008
  8018ae:	e8 1c f1 ff ff       	call   8009cf <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  8018b3:	ba 00 00 00 00       	mov    $0x0,%edx
  8018b8:	b8 04 00 00 00       	mov    $0x4,%eax
  8018bd:	e8 ba fe ff ff       	call   80177c <fsipc>
  8018c2:	c9                   	leave  
  8018c3:	c3                   	ret    

008018c4 <devfile_read>:
{
  8018c4:	f3 0f 1e fb          	endbr32 
  8018c8:	55                   	push   %ebp
  8018c9:	89 e5                	mov    %esp,%ebp
  8018cb:	56                   	push   %esi
  8018cc:	53                   	push   %ebx
  8018cd:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  8018d0:	8b 45 08             	mov    0x8(%ebp),%eax
  8018d3:	8b 40 0c             	mov    0xc(%eax),%eax
  8018d6:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  8018db:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  8018e1:	ba 00 00 00 00       	mov    $0x0,%edx
  8018e6:	b8 03 00 00 00       	mov    $0x3,%eax
  8018eb:	e8 8c fe ff ff       	call   80177c <fsipc>
  8018f0:	89 c3                	mov    %eax,%ebx
  8018f2:	85 c0                	test   %eax,%eax
  8018f4:	78 1f                	js     801915 <devfile_read+0x51>
	assert(r <= n);
  8018f6:	39 f0                	cmp    %esi,%eax
  8018f8:	77 24                	ja     80191e <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8018fa:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8018ff:	7f 33                	jg     801934 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801901:	83 ec 04             	sub    $0x4,%esp
  801904:	50                   	push   %eax
  801905:	68 00 50 80 00       	push   $0x805000
  80190a:	ff 75 0c             	pushl  0xc(%ebp)
  80190d:	e8 bd f0 ff ff       	call   8009cf <memmove>
	return r;
  801912:	83 c4 10             	add    $0x10,%esp
}
  801915:	89 d8                	mov    %ebx,%eax
  801917:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80191a:	5b                   	pop    %ebx
  80191b:	5e                   	pop    %esi
  80191c:	5d                   	pop    %ebp
  80191d:	c3                   	ret    
	assert(r <= n);
  80191e:	68 e8 28 80 00       	push   $0x8028e8
  801923:	68 ef 28 80 00       	push   $0x8028ef
  801928:	6a 7c                	push   $0x7c
  80192a:	68 04 29 80 00       	push   $0x802904
  80192f:	e8 25 e8 ff ff       	call   800159 <_panic>
	assert(r <= PGSIZE);
  801934:	68 0f 29 80 00       	push   $0x80290f
  801939:	68 ef 28 80 00       	push   $0x8028ef
  80193e:	6a 7d                	push   $0x7d
  801940:	68 04 29 80 00       	push   $0x802904
  801945:	e8 0f e8 ff ff       	call   800159 <_panic>

0080194a <open>:
{
  80194a:	f3 0f 1e fb          	endbr32 
  80194e:	55                   	push   %ebp
  80194f:	89 e5                	mov    %esp,%ebp
  801951:	56                   	push   %esi
  801952:	53                   	push   %ebx
  801953:	83 ec 1c             	sub    $0x1c,%esp
  801956:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801959:	56                   	push   %esi
  80195a:	e8 77 ee ff ff       	call   8007d6 <strlen>
  80195f:	83 c4 10             	add    $0x10,%esp
  801962:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801967:	7f 6c                	jg     8019d5 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801969:	83 ec 0c             	sub    $0xc,%esp
  80196c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80196f:	50                   	push   %eax
  801970:	e8 67 f8 ff ff       	call   8011dc <fd_alloc>
  801975:	89 c3                	mov    %eax,%ebx
  801977:	83 c4 10             	add    $0x10,%esp
  80197a:	85 c0                	test   %eax,%eax
  80197c:	78 3c                	js     8019ba <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  80197e:	83 ec 08             	sub    $0x8,%esp
  801981:	56                   	push   %esi
  801982:	68 00 50 80 00       	push   $0x805000
  801987:	e8 8d ee ff ff       	call   800819 <strcpy>
	fsipcbuf.open.req_omode = mode;
  80198c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80198f:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801994:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801997:	b8 01 00 00 00       	mov    $0x1,%eax
  80199c:	e8 db fd ff ff       	call   80177c <fsipc>
  8019a1:	89 c3                	mov    %eax,%ebx
  8019a3:	83 c4 10             	add    $0x10,%esp
  8019a6:	85 c0                	test   %eax,%eax
  8019a8:	78 19                	js     8019c3 <open+0x79>
	return fd2num(fd);
  8019aa:	83 ec 0c             	sub    $0xc,%esp
  8019ad:	ff 75 f4             	pushl  -0xc(%ebp)
  8019b0:	e8 f8 f7 ff ff       	call   8011ad <fd2num>
  8019b5:	89 c3                	mov    %eax,%ebx
  8019b7:	83 c4 10             	add    $0x10,%esp
}
  8019ba:	89 d8                	mov    %ebx,%eax
  8019bc:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8019bf:	5b                   	pop    %ebx
  8019c0:	5e                   	pop    %esi
  8019c1:	5d                   	pop    %ebp
  8019c2:	c3                   	ret    
		fd_close(fd, 0);
  8019c3:	83 ec 08             	sub    $0x8,%esp
  8019c6:	6a 00                	push   $0x0
  8019c8:	ff 75 f4             	pushl  -0xc(%ebp)
  8019cb:	e8 10 f9 ff ff       	call   8012e0 <fd_close>
		return r;
  8019d0:	83 c4 10             	add    $0x10,%esp
  8019d3:	eb e5                	jmp    8019ba <open+0x70>
		return -E_BAD_PATH;
  8019d5:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  8019da:	eb de                	jmp    8019ba <open+0x70>

008019dc <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  8019dc:	f3 0f 1e fb          	endbr32 
  8019e0:	55                   	push   %ebp
  8019e1:	89 e5                	mov    %esp,%ebp
  8019e3:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  8019e6:	ba 00 00 00 00       	mov    $0x0,%edx
  8019eb:	b8 08 00 00 00       	mov    $0x8,%eax
  8019f0:	e8 87 fd ff ff       	call   80177c <fsipc>
}
  8019f5:	c9                   	leave  
  8019f6:	c3                   	ret    

008019f7 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  8019f7:	f3 0f 1e fb          	endbr32 
  8019fb:	55                   	push   %ebp
  8019fc:	89 e5                	mov    %esp,%ebp
  8019fe:	56                   	push   %esi
  8019ff:	53                   	push   %ebx
  801a00:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801a03:	83 ec 0c             	sub    $0xc,%esp
  801a06:	ff 75 08             	pushl  0x8(%ebp)
  801a09:	e8 b3 f7 ff ff       	call   8011c1 <fd2data>
  801a0e:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801a10:	83 c4 08             	add    $0x8,%esp
  801a13:	68 1b 29 80 00       	push   $0x80291b
  801a18:	53                   	push   %ebx
  801a19:	e8 fb ed ff ff       	call   800819 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801a1e:	8b 46 04             	mov    0x4(%esi),%eax
  801a21:	2b 06                	sub    (%esi),%eax
  801a23:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801a29:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801a30:	00 00 00 
	stat->st_dev = &devpipe;
  801a33:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801a3a:	30 80 00 
	return 0;
}
  801a3d:	b8 00 00 00 00       	mov    $0x0,%eax
  801a42:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a45:	5b                   	pop    %ebx
  801a46:	5e                   	pop    %esi
  801a47:	5d                   	pop    %ebp
  801a48:	c3                   	ret    

00801a49 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801a49:	f3 0f 1e fb          	endbr32 
  801a4d:	55                   	push   %ebp
  801a4e:	89 e5                	mov    %esp,%ebp
  801a50:	53                   	push   %ebx
  801a51:	83 ec 0c             	sub    $0xc,%esp
  801a54:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801a57:	53                   	push   %ebx
  801a58:	6a 00                	push   $0x0
  801a5a:	e8 89 f2 ff ff       	call   800ce8 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801a5f:	89 1c 24             	mov    %ebx,(%esp)
  801a62:	e8 5a f7 ff ff       	call   8011c1 <fd2data>
  801a67:	83 c4 08             	add    $0x8,%esp
  801a6a:	50                   	push   %eax
  801a6b:	6a 00                	push   $0x0
  801a6d:	e8 76 f2 ff ff       	call   800ce8 <sys_page_unmap>
}
  801a72:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801a75:	c9                   	leave  
  801a76:	c3                   	ret    

00801a77 <_pipeisclosed>:
{
  801a77:	55                   	push   %ebp
  801a78:	89 e5                	mov    %esp,%ebp
  801a7a:	57                   	push   %edi
  801a7b:	56                   	push   %esi
  801a7c:	53                   	push   %ebx
  801a7d:	83 ec 1c             	sub    $0x1c,%esp
  801a80:	89 c7                	mov    %eax,%edi
  801a82:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801a84:	a1 08 40 80 00       	mov    0x804008,%eax
  801a89:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801a8c:	83 ec 0c             	sub    $0xc,%esp
  801a8f:	57                   	push   %edi
  801a90:	e8 14 06 00 00       	call   8020a9 <pageref>
  801a95:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801a98:	89 34 24             	mov    %esi,(%esp)
  801a9b:	e8 09 06 00 00       	call   8020a9 <pageref>
		nn = thisenv->env_runs;
  801aa0:	8b 15 08 40 80 00    	mov    0x804008,%edx
  801aa6:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801aa9:	83 c4 10             	add    $0x10,%esp
  801aac:	39 cb                	cmp    %ecx,%ebx
  801aae:	74 1b                	je     801acb <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801ab0:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801ab3:	75 cf                	jne    801a84 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801ab5:	8b 42 58             	mov    0x58(%edx),%eax
  801ab8:	6a 01                	push   $0x1
  801aba:	50                   	push   %eax
  801abb:	53                   	push   %ebx
  801abc:	68 22 29 80 00       	push   $0x802922
  801ac1:	e8 7a e7 ff ff       	call   800240 <cprintf>
  801ac6:	83 c4 10             	add    $0x10,%esp
  801ac9:	eb b9                	jmp    801a84 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801acb:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801ace:	0f 94 c0             	sete   %al
  801ad1:	0f b6 c0             	movzbl %al,%eax
}
  801ad4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801ad7:	5b                   	pop    %ebx
  801ad8:	5e                   	pop    %esi
  801ad9:	5f                   	pop    %edi
  801ada:	5d                   	pop    %ebp
  801adb:	c3                   	ret    

00801adc <devpipe_write>:
{
  801adc:	f3 0f 1e fb          	endbr32 
  801ae0:	55                   	push   %ebp
  801ae1:	89 e5                	mov    %esp,%ebp
  801ae3:	57                   	push   %edi
  801ae4:	56                   	push   %esi
  801ae5:	53                   	push   %ebx
  801ae6:	83 ec 28             	sub    $0x28,%esp
  801ae9:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801aec:	56                   	push   %esi
  801aed:	e8 cf f6 ff ff       	call   8011c1 <fd2data>
  801af2:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801af4:	83 c4 10             	add    $0x10,%esp
  801af7:	bf 00 00 00 00       	mov    $0x0,%edi
  801afc:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801aff:	74 4f                	je     801b50 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801b01:	8b 43 04             	mov    0x4(%ebx),%eax
  801b04:	8b 0b                	mov    (%ebx),%ecx
  801b06:	8d 51 20             	lea    0x20(%ecx),%edx
  801b09:	39 d0                	cmp    %edx,%eax
  801b0b:	72 14                	jb     801b21 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801b0d:	89 da                	mov    %ebx,%edx
  801b0f:	89 f0                	mov    %esi,%eax
  801b11:	e8 61 ff ff ff       	call   801a77 <_pipeisclosed>
  801b16:	85 c0                	test   %eax,%eax
  801b18:	75 3b                	jne    801b55 <devpipe_write+0x79>
			sys_yield();
  801b1a:	e8 19 f1 ff ff       	call   800c38 <sys_yield>
  801b1f:	eb e0                	jmp    801b01 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801b21:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801b24:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801b28:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801b2b:	89 c2                	mov    %eax,%edx
  801b2d:	c1 fa 1f             	sar    $0x1f,%edx
  801b30:	89 d1                	mov    %edx,%ecx
  801b32:	c1 e9 1b             	shr    $0x1b,%ecx
  801b35:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801b38:	83 e2 1f             	and    $0x1f,%edx
  801b3b:	29 ca                	sub    %ecx,%edx
  801b3d:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801b41:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801b45:	83 c0 01             	add    $0x1,%eax
  801b48:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801b4b:	83 c7 01             	add    $0x1,%edi
  801b4e:	eb ac                	jmp    801afc <devpipe_write+0x20>
	return i;
  801b50:	8b 45 10             	mov    0x10(%ebp),%eax
  801b53:	eb 05                	jmp    801b5a <devpipe_write+0x7e>
				return 0;
  801b55:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801b5a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b5d:	5b                   	pop    %ebx
  801b5e:	5e                   	pop    %esi
  801b5f:	5f                   	pop    %edi
  801b60:	5d                   	pop    %ebp
  801b61:	c3                   	ret    

00801b62 <devpipe_read>:
{
  801b62:	f3 0f 1e fb          	endbr32 
  801b66:	55                   	push   %ebp
  801b67:	89 e5                	mov    %esp,%ebp
  801b69:	57                   	push   %edi
  801b6a:	56                   	push   %esi
  801b6b:	53                   	push   %ebx
  801b6c:	83 ec 18             	sub    $0x18,%esp
  801b6f:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801b72:	57                   	push   %edi
  801b73:	e8 49 f6 ff ff       	call   8011c1 <fd2data>
  801b78:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801b7a:	83 c4 10             	add    $0x10,%esp
  801b7d:	be 00 00 00 00       	mov    $0x0,%esi
  801b82:	3b 75 10             	cmp    0x10(%ebp),%esi
  801b85:	75 14                	jne    801b9b <devpipe_read+0x39>
	return i;
  801b87:	8b 45 10             	mov    0x10(%ebp),%eax
  801b8a:	eb 02                	jmp    801b8e <devpipe_read+0x2c>
				return i;
  801b8c:	89 f0                	mov    %esi,%eax
}
  801b8e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b91:	5b                   	pop    %ebx
  801b92:	5e                   	pop    %esi
  801b93:	5f                   	pop    %edi
  801b94:	5d                   	pop    %ebp
  801b95:	c3                   	ret    
			sys_yield();
  801b96:	e8 9d f0 ff ff       	call   800c38 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801b9b:	8b 03                	mov    (%ebx),%eax
  801b9d:	3b 43 04             	cmp    0x4(%ebx),%eax
  801ba0:	75 18                	jne    801bba <devpipe_read+0x58>
			if (i > 0)
  801ba2:	85 f6                	test   %esi,%esi
  801ba4:	75 e6                	jne    801b8c <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801ba6:	89 da                	mov    %ebx,%edx
  801ba8:	89 f8                	mov    %edi,%eax
  801baa:	e8 c8 fe ff ff       	call   801a77 <_pipeisclosed>
  801baf:	85 c0                	test   %eax,%eax
  801bb1:	74 e3                	je     801b96 <devpipe_read+0x34>
				return 0;
  801bb3:	b8 00 00 00 00       	mov    $0x0,%eax
  801bb8:	eb d4                	jmp    801b8e <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801bba:	99                   	cltd   
  801bbb:	c1 ea 1b             	shr    $0x1b,%edx
  801bbe:	01 d0                	add    %edx,%eax
  801bc0:	83 e0 1f             	and    $0x1f,%eax
  801bc3:	29 d0                	sub    %edx,%eax
  801bc5:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801bca:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801bcd:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801bd0:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801bd3:	83 c6 01             	add    $0x1,%esi
  801bd6:	eb aa                	jmp    801b82 <devpipe_read+0x20>

00801bd8 <pipe>:
{
  801bd8:	f3 0f 1e fb          	endbr32 
  801bdc:	55                   	push   %ebp
  801bdd:	89 e5                	mov    %esp,%ebp
  801bdf:	56                   	push   %esi
  801be0:	53                   	push   %ebx
  801be1:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801be4:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801be7:	50                   	push   %eax
  801be8:	e8 ef f5 ff ff       	call   8011dc <fd_alloc>
  801bed:	89 c3                	mov    %eax,%ebx
  801bef:	83 c4 10             	add    $0x10,%esp
  801bf2:	85 c0                	test   %eax,%eax
  801bf4:	0f 88 23 01 00 00    	js     801d1d <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801bfa:	83 ec 04             	sub    $0x4,%esp
  801bfd:	68 07 04 00 00       	push   $0x407
  801c02:	ff 75 f4             	pushl  -0xc(%ebp)
  801c05:	6a 00                	push   $0x0
  801c07:	e8 4f f0 ff ff       	call   800c5b <sys_page_alloc>
  801c0c:	89 c3                	mov    %eax,%ebx
  801c0e:	83 c4 10             	add    $0x10,%esp
  801c11:	85 c0                	test   %eax,%eax
  801c13:	0f 88 04 01 00 00    	js     801d1d <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801c19:	83 ec 0c             	sub    $0xc,%esp
  801c1c:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801c1f:	50                   	push   %eax
  801c20:	e8 b7 f5 ff ff       	call   8011dc <fd_alloc>
  801c25:	89 c3                	mov    %eax,%ebx
  801c27:	83 c4 10             	add    $0x10,%esp
  801c2a:	85 c0                	test   %eax,%eax
  801c2c:	0f 88 db 00 00 00    	js     801d0d <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801c32:	83 ec 04             	sub    $0x4,%esp
  801c35:	68 07 04 00 00       	push   $0x407
  801c3a:	ff 75 f0             	pushl  -0x10(%ebp)
  801c3d:	6a 00                	push   $0x0
  801c3f:	e8 17 f0 ff ff       	call   800c5b <sys_page_alloc>
  801c44:	89 c3                	mov    %eax,%ebx
  801c46:	83 c4 10             	add    $0x10,%esp
  801c49:	85 c0                	test   %eax,%eax
  801c4b:	0f 88 bc 00 00 00    	js     801d0d <pipe+0x135>
	va = fd2data(fd0);
  801c51:	83 ec 0c             	sub    $0xc,%esp
  801c54:	ff 75 f4             	pushl  -0xc(%ebp)
  801c57:	e8 65 f5 ff ff       	call   8011c1 <fd2data>
  801c5c:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801c5e:	83 c4 0c             	add    $0xc,%esp
  801c61:	68 07 04 00 00       	push   $0x407
  801c66:	50                   	push   %eax
  801c67:	6a 00                	push   $0x0
  801c69:	e8 ed ef ff ff       	call   800c5b <sys_page_alloc>
  801c6e:	89 c3                	mov    %eax,%ebx
  801c70:	83 c4 10             	add    $0x10,%esp
  801c73:	85 c0                	test   %eax,%eax
  801c75:	0f 88 82 00 00 00    	js     801cfd <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801c7b:	83 ec 0c             	sub    $0xc,%esp
  801c7e:	ff 75 f0             	pushl  -0x10(%ebp)
  801c81:	e8 3b f5 ff ff       	call   8011c1 <fd2data>
  801c86:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801c8d:	50                   	push   %eax
  801c8e:	6a 00                	push   $0x0
  801c90:	56                   	push   %esi
  801c91:	6a 00                	push   $0x0
  801c93:	e8 0a f0 ff ff       	call   800ca2 <sys_page_map>
  801c98:	89 c3                	mov    %eax,%ebx
  801c9a:	83 c4 20             	add    $0x20,%esp
  801c9d:	85 c0                	test   %eax,%eax
  801c9f:	78 4e                	js     801cef <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801ca1:	a1 20 30 80 00       	mov    0x803020,%eax
  801ca6:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801ca9:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801cab:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801cae:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801cb5:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801cb8:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801cba:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801cbd:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801cc4:	83 ec 0c             	sub    $0xc,%esp
  801cc7:	ff 75 f4             	pushl  -0xc(%ebp)
  801cca:	e8 de f4 ff ff       	call   8011ad <fd2num>
  801ccf:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801cd2:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801cd4:	83 c4 04             	add    $0x4,%esp
  801cd7:	ff 75 f0             	pushl  -0x10(%ebp)
  801cda:	e8 ce f4 ff ff       	call   8011ad <fd2num>
  801cdf:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801ce2:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801ce5:	83 c4 10             	add    $0x10,%esp
  801ce8:	bb 00 00 00 00       	mov    $0x0,%ebx
  801ced:	eb 2e                	jmp    801d1d <pipe+0x145>
	sys_page_unmap(0, va);
  801cef:	83 ec 08             	sub    $0x8,%esp
  801cf2:	56                   	push   %esi
  801cf3:	6a 00                	push   $0x0
  801cf5:	e8 ee ef ff ff       	call   800ce8 <sys_page_unmap>
  801cfa:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801cfd:	83 ec 08             	sub    $0x8,%esp
  801d00:	ff 75 f0             	pushl  -0x10(%ebp)
  801d03:	6a 00                	push   $0x0
  801d05:	e8 de ef ff ff       	call   800ce8 <sys_page_unmap>
  801d0a:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801d0d:	83 ec 08             	sub    $0x8,%esp
  801d10:	ff 75 f4             	pushl  -0xc(%ebp)
  801d13:	6a 00                	push   $0x0
  801d15:	e8 ce ef ff ff       	call   800ce8 <sys_page_unmap>
  801d1a:	83 c4 10             	add    $0x10,%esp
}
  801d1d:	89 d8                	mov    %ebx,%eax
  801d1f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801d22:	5b                   	pop    %ebx
  801d23:	5e                   	pop    %esi
  801d24:	5d                   	pop    %ebp
  801d25:	c3                   	ret    

00801d26 <pipeisclosed>:
{
  801d26:	f3 0f 1e fb          	endbr32 
  801d2a:	55                   	push   %ebp
  801d2b:	89 e5                	mov    %esp,%ebp
  801d2d:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801d30:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801d33:	50                   	push   %eax
  801d34:	ff 75 08             	pushl  0x8(%ebp)
  801d37:	e8 f6 f4 ff ff       	call   801232 <fd_lookup>
  801d3c:	83 c4 10             	add    $0x10,%esp
  801d3f:	85 c0                	test   %eax,%eax
  801d41:	78 18                	js     801d5b <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801d43:	83 ec 0c             	sub    $0xc,%esp
  801d46:	ff 75 f4             	pushl  -0xc(%ebp)
  801d49:	e8 73 f4 ff ff       	call   8011c1 <fd2data>
  801d4e:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801d50:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801d53:	e8 1f fd ff ff       	call   801a77 <_pipeisclosed>
  801d58:	83 c4 10             	add    $0x10,%esp
}
  801d5b:	c9                   	leave  
  801d5c:	c3                   	ret    

00801d5d <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801d5d:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801d61:	b8 00 00 00 00       	mov    $0x0,%eax
  801d66:	c3                   	ret    

00801d67 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801d67:	f3 0f 1e fb          	endbr32 
  801d6b:	55                   	push   %ebp
  801d6c:	89 e5                	mov    %esp,%ebp
  801d6e:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801d71:	68 3a 29 80 00       	push   $0x80293a
  801d76:	ff 75 0c             	pushl  0xc(%ebp)
  801d79:	e8 9b ea ff ff       	call   800819 <strcpy>
	return 0;
}
  801d7e:	b8 00 00 00 00       	mov    $0x0,%eax
  801d83:	c9                   	leave  
  801d84:	c3                   	ret    

00801d85 <devcons_write>:
{
  801d85:	f3 0f 1e fb          	endbr32 
  801d89:	55                   	push   %ebp
  801d8a:	89 e5                	mov    %esp,%ebp
  801d8c:	57                   	push   %edi
  801d8d:	56                   	push   %esi
  801d8e:	53                   	push   %ebx
  801d8f:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801d95:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801d9a:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801da0:	3b 75 10             	cmp    0x10(%ebp),%esi
  801da3:	73 31                	jae    801dd6 <devcons_write+0x51>
		m = n - tot;
  801da5:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801da8:	29 f3                	sub    %esi,%ebx
  801daa:	83 fb 7f             	cmp    $0x7f,%ebx
  801dad:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801db2:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801db5:	83 ec 04             	sub    $0x4,%esp
  801db8:	53                   	push   %ebx
  801db9:	89 f0                	mov    %esi,%eax
  801dbb:	03 45 0c             	add    0xc(%ebp),%eax
  801dbe:	50                   	push   %eax
  801dbf:	57                   	push   %edi
  801dc0:	e8 0a ec ff ff       	call   8009cf <memmove>
		sys_cputs(buf, m);
  801dc5:	83 c4 08             	add    $0x8,%esp
  801dc8:	53                   	push   %ebx
  801dc9:	57                   	push   %edi
  801dca:	e8 bc ed ff ff       	call   800b8b <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801dcf:	01 de                	add    %ebx,%esi
  801dd1:	83 c4 10             	add    $0x10,%esp
  801dd4:	eb ca                	jmp    801da0 <devcons_write+0x1b>
}
  801dd6:	89 f0                	mov    %esi,%eax
  801dd8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801ddb:	5b                   	pop    %ebx
  801ddc:	5e                   	pop    %esi
  801ddd:	5f                   	pop    %edi
  801dde:	5d                   	pop    %ebp
  801ddf:	c3                   	ret    

00801de0 <devcons_read>:
{
  801de0:	f3 0f 1e fb          	endbr32 
  801de4:	55                   	push   %ebp
  801de5:	89 e5                	mov    %esp,%ebp
  801de7:	83 ec 08             	sub    $0x8,%esp
  801dea:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801def:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801df3:	74 21                	je     801e16 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801df5:	e8 b3 ed ff ff       	call   800bad <sys_cgetc>
  801dfa:	85 c0                	test   %eax,%eax
  801dfc:	75 07                	jne    801e05 <devcons_read+0x25>
		sys_yield();
  801dfe:	e8 35 ee ff ff       	call   800c38 <sys_yield>
  801e03:	eb f0                	jmp    801df5 <devcons_read+0x15>
	if (c < 0)
  801e05:	78 0f                	js     801e16 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801e07:	83 f8 04             	cmp    $0x4,%eax
  801e0a:	74 0c                	je     801e18 <devcons_read+0x38>
	*(char*)vbuf = c;
  801e0c:	8b 55 0c             	mov    0xc(%ebp),%edx
  801e0f:	88 02                	mov    %al,(%edx)
	return 1;
  801e11:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801e16:	c9                   	leave  
  801e17:	c3                   	ret    
		return 0;
  801e18:	b8 00 00 00 00       	mov    $0x0,%eax
  801e1d:	eb f7                	jmp    801e16 <devcons_read+0x36>

00801e1f <cputchar>:
{
  801e1f:	f3 0f 1e fb          	endbr32 
  801e23:	55                   	push   %ebp
  801e24:	89 e5                	mov    %esp,%ebp
  801e26:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801e29:	8b 45 08             	mov    0x8(%ebp),%eax
  801e2c:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801e2f:	6a 01                	push   $0x1
  801e31:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801e34:	50                   	push   %eax
  801e35:	e8 51 ed ff ff       	call   800b8b <sys_cputs>
}
  801e3a:	83 c4 10             	add    $0x10,%esp
  801e3d:	c9                   	leave  
  801e3e:	c3                   	ret    

00801e3f <getchar>:
{
  801e3f:	f3 0f 1e fb          	endbr32 
  801e43:	55                   	push   %ebp
  801e44:	89 e5                	mov    %esp,%ebp
  801e46:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801e49:	6a 01                	push   $0x1
  801e4b:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801e4e:	50                   	push   %eax
  801e4f:	6a 00                	push   $0x0
  801e51:	e8 5f f6 ff ff       	call   8014b5 <read>
	if (r < 0)
  801e56:	83 c4 10             	add    $0x10,%esp
  801e59:	85 c0                	test   %eax,%eax
  801e5b:	78 06                	js     801e63 <getchar+0x24>
	if (r < 1)
  801e5d:	74 06                	je     801e65 <getchar+0x26>
	return c;
  801e5f:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801e63:	c9                   	leave  
  801e64:	c3                   	ret    
		return -E_EOF;
  801e65:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801e6a:	eb f7                	jmp    801e63 <getchar+0x24>

00801e6c <iscons>:
{
  801e6c:	f3 0f 1e fb          	endbr32 
  801e70:	55                   	push   %ebp
  801e71:	89 e5                	mov    %esp,%ebp
  801e73:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801e76:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e79:	50                   	push   %eax
  801e7a:	ff 75 08             	pushl  0x8(%ebp)
  801e7d:	e8 b0 f3 ff ff       	call   801232 <fd_lookup>
  801e82:	83 c4 10             	add    $0x10,%esp
  801e85:	85 c0                	test   %eax,%eax
  801e87:	78 11                	js     801e9a <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801e89:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e8c:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801e92:	39 10                	cmp    %edx,(%eax)
  801e94:	0f 94 c0             	sete   %al
  801e97:	0f b6 c0             	movzbl %al,%eax
}
  801e9a:	c9                   	leave  
  801e9b:	c3                   	ret    

00801e9c <opencons>:
{
  801e9c:	f3 0f 1e fb          	endbr32 
  801ea0:	55                   	push   %ebp
  801ea1:	89 e5                	mov    %esp,%ebp
  801ea3:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801ea6:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801ea9:	50                   	push   %eax
  801eaa:	e8 2d f3 ff ff       	call   8011dc <fd_alloc>
  801eaf:	83 c4 10             	add    $0x10,%esp
  801eb2:	85 c0                	test   %eax,%eax
  801eb4:	78 3a                	js     801ef0 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801eb6:	83 ec 04             	sub    $0x4,%esp
  801eb9:	68 07 04 00 00       	push   $0x407
  801ebe:	ff 75 f4             	pushl  -0xc(%ebp)
  801ec1:	6a 00                	push   $0x0
  801ec3:	e8 93 ed ff ff       	call   800c5b <sys_page_alloc>
  801ec8:	83 c4 10             	add    $0x10,%esp
  801ecb:	85 c0                	test   %eax,%eax
  801ecd:	78 21                	js     801ef0 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801ecf:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801ed2:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801ed8:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801eda:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801edd:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801ee4:	83 ec 0c             	sub    $0xc,%esp
  801ee7:	50                   	push   %eax
  801ee8:	e8 c0 f2 ff ff       	call   8011ad <fd2num>
  801eed:	83 c4 10             	add    $0x10,%esp
}
  801ef0:	c9                   	leave  
  801ef1:	c3                   	ret    

00801ef2 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  801ef2:	f3 0f 1e fb          	endbr32 
  801ef6:	55                   	push   %ebp
  801ef7:	89 e5                	mov    %esp,%ebp
  801ef9:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  801efc:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  801f03:	74 27                	je     801f2c <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  801f05:	8b 45 08             	mov    0x8(%ebp),%eax
  801f08:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  801f0d:	a1 08 40 80 00       	mov    0x804008,%eax
  801f12:	8b 40 48             	mov    0x48(%eax),%eax
  801f15:	83 ec 08             	sub    $0x8,%esp
  801f18:	68 6c 1f 80 00       	push   $0x801f6c
  801f1d:	50                   	push   %eax
  801f1e:	e8 97 ee ff ff       	call   800dba <sys_env_set_pgfault_upcall>
  801f23:	83 c4 10             	add    $0x10,%esp
  801f26:	85 c0                	test   %eax,%eax
  801f28:	78 2e                	js     801f58 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  801f2a:	c9                   	leave  
  801f2b:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  801f2c:	83 ec 04             	sub    $0x4,%esp
  801f2f:	6a 07                	push   $0x7
  801f31:	68 00 f0 bf ee       	push   $0xeebff000
  801f36:	6a 00                	push   $0x0
  801f38:	e8 1e ed ff ff       	call   800c5b <sys_page_alloc>
  801f3d:	83 c4 10             	add    $0x10,%esp
  801f40:	85 c0                	test   %eax,%eax
  801f42:	79 c1                	jns    801f05 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  801f44:	83 ec 04             	sub    $0x4,%esp
  801f47:	68 48 29 80 00       	push   $0x802948
  801f4c:	6a 21                	push   $0x21
  801f4e:	68 aa 29 80 00       	push   $0x8029aa
  801f53:	e8 01 e2 ff ff       	call   800159 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  801f58:	83 ec 04             	sub    $0x4,%esp
  801f5b:	68 74 29 80 00       	push   $0x802974
  801f60:	6a 27                	push   $0x27
  801f62:	68 aa 29 80 00       	push   $0x8029aa
  801f67:	e8 ed e1 ff ff       	call   800159 <_panic>

00801f6c <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  801f6c:	54                   	push   %esp
	movl _pgfault_handler, %eax
  801f6d:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  801f72:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  801f74:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  801f77:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  801f7b:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  801f7e:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  801f82:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  801f86:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  801f89:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  801f8c:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  801f8d:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  801f90:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  801f91:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  801f92:	c3                   	ret    

00801f93 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801f93:	f3 0f 1e fb          	endbr32 
  801f97:	55                   	push   %ebp
  801f98:	89 e5                	mov    %esp,%ebp
  801f9a:	56                   	push   %esi
  801f9b:	53                   	push   %ebx
  801f9c:	8b 75 08             	mov    0x8(%ebp),%esi
  801f9f:	8b 45 0c             	mov    0xc(%ebp),%eax
  801fa2:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801fa5:	85 c0                	test   %eax,%eax
  801fa7:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801fac:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801faf:	83 ec 0c             	sub    $0xc,%esp
  801fb2:	50                   	push   %eax
  801fb3:	e8 6f ee ff ff       	call   800e27 <sys_ipc_recv>
  801fb8:	83 c4 10             	add    $0x10,%esp
  801fbb:	85 c0                	test   %eax,%eax
  801fbd:	78 3f                	js     801ffe <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801fbf:	e8 51 ec ff ff       	call   800c15 <sys_getenvid>
  801fc4:	25 ff 03 00 00       	and    $0x3ff,%eax
  801fc9:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801fcc:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801fd2:	89 15 08 40 80 00    	mov    %edx,0x804008

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801fd8:	85 f6                	test   %esi,%esi
  801fda:	74 05                	je     801fe1 <ipc_recv+0x4e>
  801fdc:	8b 42 74             	mov    0x74(%edx),%eax
  801fdf:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801fe1:	85 db                	test   %ebx,%ebx
  801fe3:	74 0a                	je     801fef <ipc_recv+0x5c>
  801fe5:	a1 08 40 80 00       	mov    0x804008,%eax
  801fea:	8b 40 78             	mov    0x78(%eax),%eax
  801fed:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801fef:	a1 08 40 80 00       	mov    0x804008,%eax
  801ff4:	8b 40 70             	mov    0x70(%eax),%eax
}
  801ff7:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ffa:	5b                   	pop    %ebx
  801ffb:	5e                   	pop    %esi
  801ffc:	5d                   	pop    %ebp
  801ffd:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801ffe:	85 f6                	test   %esi,%esi
  802000:	74 06                	je     802008 <ipc_recv+0x75>
  802002:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  802008:	85 db                	test   %ebx,%ebx
  80200a:	74 eb                	je     801ff7 <ipc_recv+0x64>
  80200c:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  802012:	eb e3                	jmp    801ff7 <ipc_recv+0x64>

00802014 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  802014:	f3 0f 1e fb          	endbr32 
  802018:	55                   	push   %ebp
  802019:	89 e5                	mov    %esp,%ebp
  80201b:	57                   	push   %edi
  80201c:	56                   	push   %esi
  80201d:	53                   	push   %ebx
  80201e:	83 ec 0c             	sub    $0xc,%esp
  802021:	8b 7d 08             	mov    0x8(%ebp),%edi
  802024:	8b 75 0c             	mov    0xc(%ebp),%esi
  802027:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  80202a:	85 db                	test   %ebx,%ebx
  80202c:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  802031:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  802034:	ff 75 14             	pushl  0x14(%ebp)
  802037:	53                   	push   %ebx
  802038:	56                   	push   %esi
  802039:	57                   	push   %edi
  80203a:	e8 c1 ed ff ff       	call   800e00 <sys_ipc_try_send>
  80203f:	83 c4 10             	add    $0x10,%esp
  802042:	85 c0                	test   %eax,%eax
  802044:	79 1e                	jns    802064 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  802046:	83 f8 f9             	cmp    $0xfffffff9,%eax
  802049:	75 07                	jne    802052 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  80204b:	e8 e8 eb ff ff       	call   800c38 <sys_yield>
  802050:	eb e2                	jmp    802034 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  802052:	50                   	push   %eax
  802053:	68 b8 29 80 00       	push   $0x8029b8
  802058:	6a 3b                	push   $0x3b
  80205a:	68 cc 29 80 00       	push   $0x8029cc
  80205f:	e8 f5 e0 ff ff       	call   800159 <_panic>
	}
}
  802064:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802067:	5b                   	pop    %ebx
  802068:	5e                   	pop    %esi
  802069:	5f                   	pop    %edi
  80206a:	5d                   	pop    %ebp
  80206b:	c3                   	ret    

0080206c <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  80206c:	f3 0f 1e fb          	endbr32 
  802070:	55                   	push   %ebp
  802071:	89 e5                	mov    %esp,%ebp
  802073:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  802076:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  80207b:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80207e:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802084:	8b 52 50             	mov    0x50(%edx),%edx
  802087:	39 ca                	cmp    %ecx,%edx
  802089:	74 11                	je     80209c <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  80208b:	83 c0 01             	add    $0x1,%eax
  80208e:	3d 00 04 00 00       	cmp    $0x400,%eax
  802093:	75 e6                	jne    80207b <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  802095:	b8 00 00 00 00       	mov    $0x0,%eax
  80209a:	eb 0b                	jmp    8020a7 <ipc_find_env+0x3b>
			return envs[i].env_id;
  80209c:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80209f:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8020a4:	8b 40 48             	mov    0x48(%eax),%eax
}
  8020a7:	5d                   	pop    %ebp
  8020a8:	c3                   	ret    

008020a9 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  8020a9:	f3 0f 1e fb          	endbr32 
  8020ad:	55                   	push   %ebp
  8020ae:	89 e5                	mov    %esp,%ebp
  8020b0:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  8020b3:	89 c2                	mov    %eax,%edx
  8020b5:	c1 ea 16             	shr    $0x16,%edx
  8020b8:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  8020bf:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8020c4:	f6 c1 01             	test   $0x1,%cl
  8020c7:	74 1c                	je     8020e5 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  8020c9:	c1 e8 0c             	shr    $0xc,%eax
  8020cc:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8020d3:	a8 01                	test   $0x1,%al
  8020d5:	74 0e                	je     8020e5 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8020d7:	c1 e8 0c             	shr    $0xc,%eax
  8020da:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8020e1:	ef 
  8020e2:	0f b7 d2             	movzwl %dx,%edx
}
  8020e5:	89 d0                	mov    %edx,%eax
  8020e7:	5d                   	pop    %ebp
  8020e8:	c3                   	ret    
  8020e9:	66 90                	xchg   %ax,%ax
  8020eb:	66 90                	xchg   %ax,%ax
  8020ed:	66 90                	xchg   %ax,%ax
  8020ef:	90                   	nop

008020f0 <__udivdi3>:
  8020f0:	f3 0f 1e fb          	endbr32 
  8020f4:	55                   	push   %ebp
  8020f5:	57                   	push   %edi
  8020f6:	56                   	push   %esi
  8020f7:	53                   	push   %ebx
  8020f8:	83 ec 1c             	sub    $0x1c,%esp
  8020fb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8020ff:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  802103:	8b 74 24 34          	mov    0x34(%esp),%esi
  802107:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  80210b:	85 d2                	test   %edx,%edx
  80210d:	75 19                	jne    802128 <__udivdi3+0x38>
  80210f:	39 f3                	cmp    %esi,%ebx
  802111:	76 4d                	jbe    802160 <__udivdi3+0x70>
  802113:	31 ff                	xor    %edi,%edi
  802115:	89 e8                	mov    %ebp,%eax
  802117:	89 f2                	mov    %esi,%edx
  802119:	f7 f3                	div    %ebx
  80211b:	89 fa                	mov    %edi,%edx
  80211d:	83 c4 1c             	add    $0x1c,%esp
  802120:	5b                   	pop    %ebx
  802121:	5e                   	pop    %esi
  802122:	5f                   	pop    %edi
  802123:	5d                   	pop    %ebp
  802124:	c3                   	ret    
  802125:	8d 76 00             	lea    0x0(%esi),%esi
  802128:	39 f2                	cmp    %esi,%edx
  80212a:	76 14                	jbe    802140 <__udivdi3+0x50>
  80212c:	31 ff                	xor    %edi,%edi
  80212e:	31 c0                	xor    %eax,%eax
  802130:	89 fa                	mov    %edi,%edx
  802132:	83 c4 1c             	add    $0x1c,%esp
  802135:	5b                   	pop    %ebx
  802136:	5e                   	pop    %esi
  802137:	5f                   	pop    %edi
  802138:	5d                   	pop    %ebp
  802139:	c3                   	ret    
  80213a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802140:	0f bd fa             	bsr    %edx,%edi
  802143:	83 f7 1f             	xor    $0x1f,%edi
  802146:	75 48                	jne    802190 <__udivdi3+0xa0>
  802148:	39 f2                	cmp    %esi,%edx
  80214a:	72 06                	jb     802152 <__udivdi3+0x62>
  80214c:	31 c0                	xor    %eax,%eax
  80214e:	39 eb                	cmp    %ebp,%ebx
  802150:	77 de                	ja     802130 <__udivdi3+0x40>
  802152:	b8 01 00 00 00       	mov    $0x1,%eax
  802157:	eb d7                	jmp    802130 <__udivdi3+0x40>
  802159:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802160:	89 d9                	mov    %ebx,%ecx
  802162:	85 db                	test   %ebx,%ebx
  802164:	75 0b                	jne    802171 <__udivdi3+0x81>
  802166:	b8 01 00 00 00       	mov    $0x1,%eax
  80216b:	31 d2                	xor    %edx,%edx
  80216d:	f7 f3                	div    %ebx
  80216f:	89 c1                	mov    %eax,%ecx
  802171:	31 d2                	xor    %edx,%edx
  802173:	89 f0                	mov    %esi,%eax
  802175:	f7 f1                	div    %ecx
  802177:	89 c6                	mov    %eax,%esi
  802179:	89 e8                	mov    %ebp,%eax
  80217b:	89 f7                	mov    %esi,%edi
  80217d:	f7 f1                	div    %ecx
  80217f:	89 fa                	mov    %edi,%edx
  802181:	83 c4 1c             	add    $0x1c,%esp
  802184:	5b                   	pop    %ebx
  802185:	5e                   	pop    %esi
  802186:	5f                   	pop    %edi
  802187:	5d                   	pop    %ebp
  802188:	c3                   	ret    
  802189:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802190:	89 f9                	mov    %edi,%ecx
  802192:	b8 20 00 00 00       	mov    $0x20,%eax
  802197:	29 f8                	sub    %edi,%eax
  802199:	d3 e2                	shl    %cl,%edx
  80219b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80219f:	89 c1                	mov    %eax,%ecx
  8021a1:	89 da                	mov    %ebx,%edx
  8021a3:	d3 ea                	shr    %cl,%edx
  8021a5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8021a9:	09 d1                	or     %edx,%ecx
  8021ab:	89 f2                	mov    %esi,%edx
  8021ad:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8021b1:	89 f9                	mov    %edi,%ecx
  8021b3:	d3 e3                	shl    %cl,%ebx
  8021b5:	89 c1                	mov    %eax,%ecx
  8021b7:	d3 ea                	shr    %cl,%edx
  8021b9:	89 f9                	mov    %edi,%ecx
  8021bb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8021bf:	89 eb                	mov    %ebp,%ebx
  8021c1:	d3 e6                	shl    %cl,%esi
  8021c3:	89 c1                	mov    %eax,%ecx
  8021c5:	d3 eb                	shr    %cl,%ebx
  8021c7:	09 de                	or     %ebx,%esi
  8021c9:	89 f0                	mov    %esi,%eax
  8021cb:	f7 74 24 08          	divl   0x8(%esp)
  8021cf:	89 d6                	mov    %edx,%esi
  8021d1:	89 c3                	mov    %eax,%ebx
  8021d3:	f7 64 24 0c          	mull   0xc(%esp)
  8021d7:	39 d6                	cmp    %edx,%esi
  8021d9:	72 15                	jb     8021f0 <__udivdi3+0x100>
  8021db:	89 f9                	mov    %edi,%ecx
  8021dd:	d3 e5                	shl    %cl,%ebp
  8021df:	39 c5                	cmp    %eax,%ebp
  8021e1:	73 04                	jae    8021e7 <__udivdi3+0xf7>
  8021e3:	39 d6                	cmp    %edx,%esi
  8021e5:	74 09                	je     8021f0 <__udivdi3+0x100>
  8021e7:	89 d8                	mov    %ebx,%eax
  8021e9:	31 ff                	xor    %edi,%edi
  8021eb:	e9 40 ff ff ff       	jmp    802130 <__udivdi3+0x40>
  8021f0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8021f3:	31 ff                	xor    %edi,%edi
  8021f5:	e9 36 ff ff ff       	jmp    802130 <__udivdi3+0x40>
  8021fa:	66 90                	xchg   %ax,%ax
  8021fc:	66 90                	xchg   %ax,%ax
  8021fe:	66 90                	xchg   %ax,%ax

00802200 <__umoddi3>:
  802200:	f3 0f 1e fb          	endbr32 
  802204:	55                   	push   %ebp
  802205:	57                   	push   %edi
  802206:	56                   	push   %esi
  802207:	53                   	push   %ebx
  802208:	83 ec 1c             	sub    $0x1c,%esp
  80220b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80220f:	8b 74 24 30          	mov    0x30(%esp),%esi
  802213:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802217:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80221b:	85 c0                	test   %eax,%eax
  80221d:	75 19                	jne    802238 <__umoddi3+0x38>
  80221f:	39 df                	cmp    %ebx,%edi
  802221:	76 5d                	jbe    802280 <__umoddi3+0x80>
  802223:	89 f0                	mov    %esi,%eax
  802225:	89 da                	mov    %ebx,%edx
  802227:	f7 f7                	div    %edi
  802229:	89 d0                	mov    %edx,%eax
  80222b:	31 d2                	xor    %edx,%edx
  80222d:	83 c4 1c             	add    $0x1c,%esp
  802230:	5b                   	pop    %ebx
  802231:	5e                   	pop    %esi
  802232:	5f                   	pop    %edi
  802233:	5d                   	pop    %ebp
  802234:	c3                   	ret    
  802235:	8d 76 00             	lea    0x0(%esi),%esi
  802238:	89 f2                	mov    %esi,%edx
  80223a:	39 d8                	cmp    %ebx,%eax
  80223c:	76 12                	jbe    802250 <__umoddi3+0x50>
  80223e:	89 f0                	mov    %esi,%eax
  802240:	89 da                	mov    %ebx,%edx
  802242:	83 c4 1c             	add    $0x1c,%esp
  802245:	5b                   	pop    %ebx
  802246:	5e                   	pop    %esi
  802247:	5f                   	pop    %edi
  802248:	5d                   	pop    %ebp
  802249:	c3                   	ret    
  80224a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802250:	0f bd e8             	bsr    %eax,%ebp
  802253:	83 f5 1f             	xor    $0x1f,%ebp
  802256:	75 50                	jne    8022a8 <__umoddi3+0xa8>
  802258:	39 d8                	cmp    %ebx,%eax
  80225a:	0f 82 e0 00 00 00    	jb     802340 <__umoddi3+0x140>
  802260:	89 d9                	mov    %ebx,%ecx
  802262:	39 f7                	cmp    %esi,%edi
  802264:	0f 86 d6 00 00 00    	jbe    802340 <__umoddi3+0x140>
  80226a:	89 d0                	mov    %edx,%eax
  80226c:	89 ca                	mov    %ecx,%edx
  80226e:	83 c4 1c             	add    $0x1c,%esp
  802271:	5b                   	pop    %ebx
  802272:	5e                   	pop    %esi
  802273:	5f                   	pop    %edi
  802274:	5d                   	pop    %ebp
  802275:	c3                   	ret    
  802276:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80227d:	8d 76 00             	lea    0x0(%esi),%esi
  802280:	89 fd                	mov    %edi,%ebp
  802282:	85 ff                	test   %edi,%edi
  802284:	75 0b                	jne    802291 <__umoddi3+0x91>
  802286:	b8 01 00 00 00       	mov    $0x1,%eax
  80228b:	31 d2                	xor    %edx,%edx
  80228d:	f7 f7                	div    %edi
  80228f:	89 c5                	mov    %eax,%ebp
  802291:	89 d8                	mov    %ebx,%eax
  802293:	31 d2                	xor    %edx,%edx
  802295:	f7 f5                	div    %ebp
  802297:	89 f0                	mov    %esi,%eax
  802299:	f7 f5                	div    %ebp
  80229b:	89 d0                	mov    %edx,%eax
  80229d:	31 d2                	xor    %edx,%edx
  80229f:	eb 8c                	jmp    80222d <__umoddi3+0x2d>
  8022a1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8022a8:	89 e9                	mov    %ebp,%ecx
  8022aa:	ba 20 00 00 00       	mov    $0x20,%edx
  8022af:	29 ea                	sub    %ebp,%edx
  8022b1:	d3 e0                	shl    %cl,%eax
  8022b3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8022b7:	89 d1                	mov    %edx,%ecx
  8022b9:	89 f8                	mov    %edi,%eax
  8022bb:	d3 e8                	shr    %cl,%eax
  8022bd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8022c1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8022c5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8022c9:	09 c1                	or     %eax,%ecx
  8022cb:	89 d8                	mov    %ebx,%eax
  8022cd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022d1:	89 e9                	mov    %ebp,%ecx
  8022d3:	d3 e7                	shl    %cl,%edi
  8022d5:	89 d1                	mov    %edx,%ecx
  8022d7:	d3 e8                	shr    %cl,%eax
  8022d9:	89 e9                	mov    %ebp,%ecx
  8022db:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8022df:	d3 e3                	shl    %cl,%ebx
  8022e1:	89 c7                	mov    %eax,%edi
  8022e3:	89 d1                	mov    %edx,%ecx
  8022e5:	89 f0                	mov    %esi,%eax
  8022e7:	d3 e8                	shr    %cl,%eax
  8022e9:	89 e9                	mov    %ebp,%ecx
  8022eb:	89 fa                	mov    %edi,%edx
  8022ed:	d3 e6                	shl    %cl,%esi
  8022ef:	09 d8                	or     %ebx,%eax
  8022f1:	f7 74 24 08          	divl   0x8(%esp)
  8022f5:	89 d1                	mov    %edx,%ecx
  8022f7:	89 f3                	mov    %esi,%ebx
  8022f9:	f7 64 24 0c          	mull   0xc(%esp)
  8022fd:	89 c6                	mov    %eax,%esi
  8022ff:	89 d7                	mov    %edx,%edi
  802301:	39 d1                	cmp    %edx,%ecx
  802303:	72 06                	jb     80230b <__umoddi3+0x10b>
  802305:	75 10                	jne    802317 <__umoddi3+0x117>
  802307:	39 c3                	cmp    %eax,%ebx
  802309:	73 0c                	jae    802317 <__umoddi3+0x117>
  80230b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80230f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802313:	89 d7                	mov    %edx,%edi
  802315:	89 c6                	mov    %eax,%esi
  802317:	89 ca                	mov    %ecx,%edx
  802319:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80231e:	29 f3                	sub    %esi,%ebx
  802320:	19 fa                	sbb    %edi,%edx
  802322:	89 d0                	mov    %edx,%eax
  802324:	d3 e0                	shl    %cl,%eax
  802326:	89 e9                	mov    %ebp,%ecx
  802328:	d3 eb                	shr    %cl,%ebx
  80232a:	d3 ea                	shr    %cl,%edx
  80232c:	09 d8                	or     %ebx,%eax
  80232e:	83 c4 1c             	add    $0x1c,%esp
  802331:	5b                   	pop    %ebx
  802332:	5e                   	pop    %esi
  802333:	5f                   	pop    %edi
  802334:	5d                   	pop    %ebp
  802335:	c3                   	ret    
  802336:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80233d:	8d 76 00             	lea    0x0(%esi),%esi
  802340:	29 fe                	sub    %edi,%esi
  802342:	19 c3                	sbb    %eax,%ebx
  802344:	89 f2                	mov    %esi,%edx
  802346:	89 d9                	mov    %ebx,%ecx
  802348:	e9 1d ff ff ff       	jmp    80226a <__umoddi3+0x6a>
